-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclear_struct.c
46 lines (40 loc) · 890 Bytes
/
clear_struct.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
#include "so_long.h"
void clear_all(t_st_list *list)
{
clear_or_map(list->or_map);
clear_img(list->img, list->window);
clear_window(list->window);
free(list);
list = NULL;
exit(0);
}
void clear_or_map(t_map *or_map)
{
my_clean_vect(or_map->map);
free(or_map);
or_map = NULL;
}
void clear_cp_map(t_map *cp_map)
{
my_clean_vect(cp_map->map);
free(cp_map);
cp_map = NULL;
}
void clear_window(t_window *window)
{
mlx_destroy_window(window->mlx, window->mlx_win);
mlx_destroy_display(window->mlx);
free(window->mlx);
free(window);
window = NULL;
}
void clear_img(t_img *img, t_window *window)
{
mlx_destroy_image(window->mlx, img->mlx_player);
mlx_destroy_image(window->mlx, img->mlx_collectable);
mlx_destroy_image(window->mlx, img->mlx_exit);
mlx_destroy_image(window->mlx, img->mlx_wall);
mlx_destroy_image(window->mlx, img->mlx_space);
free(img);
img = NULL;
}