-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_treat_res.c
35 lines (32 loc) · 1.44 KB
/
ft_treat_res.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_trest_res.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hmoumani <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/11/02 14:12:52 by hmoumani #+# #+# */
/* Updated: 2020/11/02 14:12:54 by hmoumani ### ########.fr */
/* */
/* ************************************************************************** */
#include "lib.h"
void ft_treat_res(char **ptr)
{
int h;
int w;
if (g_conf.win_h != -1)
ft_error("Resolution repeated.\n");
if (ft_ptr_str_len(ptr) != 3)
ft_error("in Resolution. usage: R HEIGHT WIDTH\n");
g_conf.win_h = ft_atoi(ptr[1], 0);
g_conf.win_w = ft_atoi(ptr[2], 0);
if (g_conf.win_h <= 0 || g_conf.win_w <= 0)
ft_error("in Resolution. use just numbers superior then 0\n");
mlx_get_screen_size(g_env.ptr, &w, &h);
if (g_conf.win_h >= h)
g_conf.win_h = h;
if (g_conf.win_w >= w)
g_conf.win_w = w;
g_conf.num_rays = g_conf.win_w;
g_conf.count++;
}