-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
45 lines (41 loc) · 1.51 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: agaliste <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/05 01:48:37 by agaliste #+# #+# */
/* Updated: 2022/01/20 12:43:06 by agaliste ### ########.fr */
/* */
/* ************************************************************************** */
#include "solong.h"
static inline void
startmlx(t_data img)
{
mlx_hook(img.win, 17, 0L, prgclose, &img);
mlx_hook(img.win, 2, 1L << 0, key_hook, &img);
mlx_loop(img.mlx);
}
int
main(int argc, char **argv)
{
t_data img;
int fd;
img.coin = 0;
img.cocur = 0;
img.moves = 0;
parseinput(argc, argv[1]);
fd = open(argv[1], O_RDONLY);
img.map = parsemap(fd);
close(fd);
img.y_size = getleny(img.map);
img.x_size = ft_strnllen(img.map[0]);
checkmapcontent(img.map, &img);
img.mlx = mlx_init();
img.win = mlx_new_window(img.mlx, 32 * img.x_size, 32 * img.y_size,
"Er so long mu largo");
draw(&img, 0);
startmlx(img);
return (0);
}