-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools.c
45 lines (41 loc) · 1.38 KB
/
tools.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tools.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: atabiti <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/13 08:45:08 by atabiti #+# #+# */
/* Updated: 2022/03/25 12:31:12 by atabiti ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
/*
Keycodes :
ESC = 53
W = 13
A = 0
S = 1
D = 2
*/
int deal_key(int key, struct s_s2 *a)
{
if (key == 53)
{
ft_free(a->exactarray, a->to_free + 1);
exit(1);
}
ft_key_a(key, a);
ft_key_d(key, a);
ft_key_w(key, a);
ft_key_s(key, a);
return (0);
}
void put_image(struct s_s2 *a, char *filename)
{
int res;
res = 50;
a->img = mlx_xpm_file_to_image(a->mlx, filename, &res, &res);
mlx_put_image_to_window(a->mlx, a->win, a->img, a->x, a->y);
mlx_destroy_image(a->mlx, a->img);
}