-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_exit.c
67 lines (58 loc) · 1.78 KB
/
clean_exit.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* clean_exit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bmerchin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/23 17:06:22 by bmerchin #+# #+# */
/* Updated: 2021/02/23 17:07:10 by bmerchin ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
int clean_exit(int keycode, t_data *data)
{
if (keycode == KEY_ESCAPE)
data->escape = 1;
return (0);
}
#if LINUX == 1
int exit_free(t_data *data)
{
int i;
i = 0;
if (BONUS)
echo_the_end(data);
free_struct(data, 1);
mlx_destroy_image(data->mlx, data->img);
while (i < 5 + BONUS * (NUM_SPRITE_BOMUS + NUM_TEXTURE_BONUS))
{
mlx_destroy_image(data->mlx, data->text[i].img);
i++;
}
if (data->save == 0)
mlx_destroy_window(data->mlx, data->win);
mlx_destroy_display(data->mlx);
free(data->mlx);
exit(0);
}
#else
int exit_free(t_data *data)
{
int i;
i = 0;
if (BONUS)
echo_the_end(data);
free_struct(data, 1);
mlx_destroy_image(data->mlx, data->img);
while (i < 5 + BONUS * (NUM_SPRITE_BOMUS + NUM_TEXTURE_BONUS))
{
mlx_destroy_image(data->mlx, data->text[i].img);
i++;
}
if (data->save == 0)
mlx_destroy_window(data->mlx, data->win);
free(data->mlx);
exit(0);
}
#endif