-
Notifications
You must be signed in to change notification settings - Fork 0
/
hook.c
31 lines (28 loc) · 1.36 KB
/
hook.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hook.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rghouzra <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/21 14:12:30 by rghouzra #+# #+# */
/* Updated: 2022/11/21 15:21:57 by rghouzra ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractal.h"
int ft_close(t_data *param)
{
mlx_destroy_image(param->ptr->mlx_ptr, param->img);
mlx_destroy_window(param->ptr->mlx_ptr, param->ptr->mlx_win);
free(param->julia_ptr);
free(param);
exit(1);
return (1);
}
void ft_hook_event(t_list *fractal, t_data *data)
{
mlx_key_hook(fractal->mlx_win, handle_keyboard, data);
mlx_hook(fractal->mlx_win, 4, 0, &mouse_hook, data);
mlx_hook(fractal->mlx_win, 6, 0, &mouse_move, data);
mlx_hook(fractal->mlx_win, 17, 0, ft_close, data);
}