-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhook.c
62 lines (58 loc) · 1.73 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
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hook.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mzane <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/10 07:13:23 by mzane #+# #+# */
/* Updated: 2015/05/05 18:44:10 by mzane ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
#include "mlx.h"
int expose_hook(t_env *e)
{
calcule_coord(e);
mlx_put_image_to_window(e->mlx, e->win, e->img, 0, 0);
put_info_to_windows(e);
return (0);
}
int key_hook(int keycode, t_env *e)
{
if (keycode == 53)
{
mlx_destroy_image(e->mlx, e->img);
mlx_destroy_window(e->mlx, e->win);
exit(0);
}
if (keycode == 69)
zoom_map(e);
if (keycode == 78)
de_zoom_map(e);
if (keycode == 126)
move_image_up(e);
if (keycode == 125)
move_image_down(e);
if (keycode == 123)
move_image_left(e);
if (keycode == 124)
move_image_right(e);
if (keycode == 75)
rotation_left(e);
if (keycode == 67)
rotation_right(e);
if (keycode == 31)
default_mode(e);
return (0);
}
int mouse_hook(int button, int x, int y, t_env *e)
{
if (button == 1)
increase_pike(e);
if (button == 2)
decrease_pike(e);
(void)x;
(void)y;
return (0);
}