aboutsummaryrefslogtreecommitdiff
path: root/src/parse/parse_resolution.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-30 15:52:16 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-30 15:52:16 +0100
commit57867bbbdc24b734d85f8d3569c7ad27dcd9504d (patch)
tree1727dd02444038341746894268ecea62b84aaea1 /src/parse/parse_resolution.c
parent3a164bce55e173d5204c4aaa66dd4eb5bc1762f9 (diff)
downloadcub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.tar.gz
cub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.tar.bz2
cub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.zip
files restructuration
Diffstat (limited to 'src/parse/parse_resolution.c')
-rw-r--r--src/parse/parse_resolution.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/parse/parse_resolution.c b/src/parse/parse_resolution.c
new file mode 100644
index 0000000..d6c5759
--- /dev/null
+++ b/src/parse/parse_resolution.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* parse_resolution.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/11/15 09:29:27 by cacharle #+# #+# */
+/* Updated: 2020/01/11 09:44:18 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "cub3d.h"
+
+t_bool parse_resolution(t_state *state, char *line)
+{
+ if ((state->window.width = ft_atoi(line)) < 0)
+ return (FALSE);
+ if ((line = ft_strrchr(line, ' ') + 1) == NULL)
+ return (FALSE);
+ if ((state->window.height = ft_atoi(line)) < 0)
+ return (FALSE);
+ return (TRUE);
+}