This repository has been archived by the owner on Apr 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
47 lines (42 loc) · 1.46 KB
/
main.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
36
37
38
39
40
41
42
43
44
45
46
47
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: drestles <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/05 17:13:26 by gkessler #+# #+# */
/* Updated: 2019/02/17 18:08:17 by drestles ### ########.fr */
/* */
/* ************************************************************************** */
#include "rtv1.h"
void init_main(t_rt *rt)
{
rt->mlx_ptr = mlx_init();
rt->win_ptr = mlx_new_window(rt->mlx_ptr, W_W, W_H, "RTv1");
}
int ft_error(char *line)
{
ft_putendl(line);
exit(0);
}
int main(int ac, char **av)
{
t_rt *rt;
if (ac == 2)
{
if (!(rt = (t_rt*)malloc(sizeof(t_rt))))
exit(1);
parser(av[1], rt);
if (rt->light[0].type == 0)
ft_error("No light is scene :(");
init_main(rt);
rtv1(rt);
mlx_hook(rt->win_ptr, 2, 0, deal_key, rt);
mlx_hook(rt->win_ptr, 17, 0, exit_x, rt);
mlx_loop(rt->mlx_ptr);
}
else
ft_error("No file appeared :(");
return (0);
}