-
Notifications
You must be signed in to change notification settings - Fork 0
/
mlx.c
70 lines (66 loc) · 1.83 KB
/
mlx.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
68
69
70
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* mlx.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: syusof <syusof@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/07 23:44:16 by syusof #+# #+# */
/* Updated: 2016/10/27 09:23:39 by syusof ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
int key_hook1(int keycode, t_env2 *env2)
{
if (keycode == 53)
exit(0);
if (keycode == 123)
env2->offx -= 30;
if (keycode == 124)
env2->offx += 30;
if (keycode == 125)
env2->offy += 30;
if (keycode == 126)
env2->offy -= 30;
if (keycode == 69)
env2->coeff += 1;
if (keycode == 78)
{
if ((env2->coeff - 1) > 0)
env2->coeff -= 1;
}
key_hook3(keycode, env2);
expose_hook1(env2);
return (0);
}
void key_hook3(int keycode, t_env2 *env2)
{
if (keycode == 8)
{
if (env2->i < 5)
{
if (env2->i == 0)
env2->color = 0x00FFFF;
else if (env2->i == 1)
env2->color = 0x008000;
else if (env2->i == 2)
env2->color = 0xFFFF00;
else if (env2->i == 3)
env2->color = 0x0000FF;
else if (env2->i == 4)
env2->color = 0xFF00FF;
(env2->i)++;
}
else
{
env2->color = 0xFF0000;
env2->i = 0;
}
}
}
int expose_hook1(t_env2 *env2)
{
mlx_clear_window(env2->mlx, env2->win);
draw1(env2);
return (0);
}