-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhooks_utils.c
41 lines (37 loc) · 1.4 KB
/
hooks_utils.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
/* ************************************************************************** */
/* */
/* :::::::: */
/* hooks_utils.c :+: :+: */
/* +:+ */
/* By: jvan-hal <[email protected]> +#+ */
/* +#+ */
/* Created: 2023/02/23 12:01:29 by jvan-hal #+# #+# */
/* Updated: 2023/02/28 14:47:38 by jvan-hal ######## odam.nl */
/* */
/* ************************************************************************** */
#include<stdlib.h>
#include"fdf.h"
void close_fdf(t_fdf *fdf)
{
mlx_close_window(fdf->mlx);
free_fdf(fdf);
exit(EXIT_SUCCESS);
}
void delete_prev_img(t_fdf *fdf)
{
if (!fdf->img[0])
return ;
mlx_delete_image(fdf->mlx, fdf->img[0]);
fdf->img[0] = NULL;
free(fdf->texture[0]->pixels);
fdf->texture[0]->pixels = NULL;
free(fdf->texture[0]);
fdf->texture[0] = NULL;
}
void create_new_image(t_fdf *fdf)
{
fdf->img[0] = generate_image(fdf);
if (!fdf->img[0])
return ;
mlx_image_to_window(fdf->mlx, fdf->img[0], fdf->ox, fdf->oy);
}