aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_screen_size.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-05 13:32:40 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-05 13:32:40 +0100
commitd1097088999c538601158805cf77250d51513f98 (patch)
tree731f010c02189ff0df4530640a2d30e50160a80a /src/ft_get_screen_size.c
parentScale (diff)
download42-cub3d-d1097088999c538601158805cf77250d51513f98.tar.gz
42-cub3d-d1097088999c538601158805cf77250d51513f98.tar.bz2
42-cub3d-d1097088999c538601158805cf77250d51513f98.tar.xz
42-cub3d-d1097088999c538601158805cf77250d51513f98.tar.zst
42-cub3d-d1097088999c538601158805cf77250d51513f98.zip
Don't mess with me boy
Diffstat (limited to 'src/ft_get_screen_size.c')
-rw-r--r--src/ft_get_screen_size.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ft_get_screen_size.c b/src/ft_get_screen_size.c
new file mode 100644
index 0000000..cd9b162
--- /dev/null
+++ b/src/ft_get_screen_size.c
@@ -0,0 +1,16 @@
+#include <libft.h>
+#include <cub3d.h>
+
+int8_t
+ft_get_screen_size(t_win *wlist)
+{
+ char **words;
+
+ if (!(words = ft_split(FT_SCR_SIZE, 'x')))
+ return (-1);
+ if (!(*words + 0) || !(*(words + 1)) || (*(words + 2)))
+ return (-1);
+ wlist->x_max_size = ft_atoi(words[0]);
+ wlist->y_max_size = ft_atoi(words[1]);
+ return (ft_free_words(words));
+}