aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
blob: 8c8aad8f78979b7a1f2a26c5257d164d75b8193b (plain)
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
#include <libft.h>
#include <mlx.h>
#include <cub3d.h>

int
	main(void)
{
	t_cub	*clist;

	if (!(clist = ft_init_cub()))
	{
		ft_memdel((void**)&clist);
		return (1);
	}
	if (!(clist->wlist = ft_init_win()))
	{
		ft_memdel((void**)&clist->wlist);
		ft_memdel((void**)&clist);
		return (1);
	}
	ft_parse_map("map/map_one.cub", clist);
	if (ft_init_winlx(clist) < 0)
		return (ft_exit(3, clist));
	mlx_key_hook(clist->wlist->winptr, ft_key_event, clist);
	ft_drawmap(clist);
	mlx_loop(clist->wlist->wlx);
	return (0);
}