-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.c
64 lines (60 loc) · 1.77 KB
/
actions.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* actions.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kprytkov <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/18 16:48:40 by kprytkov #+# #+# */
/* Updated: 2018/05/18 16:48:42 by kprytkov ### ########.fr */
/* */
/* ************************************************************************** */
#include "./includes/fdf.h"
static void guess_color(int keycode, t_env *e)
{
if (keycode == 18)
e->color_change = 0;
if (keycode == 19)
e->color_change = 1;
if (keycode == 20)
e->color_change = 2;
if (keycode == 21)
e->color_change = 3;
}
static void change_angle(int keycode, t_env *e)
{
if (keycode == 126)
e->angle_x += 5;
if (keycode == 125)
e->angle_x -= 5;
if (keycode == 123)
e->angle_y += 5;
if (keycode == 124)
e->angle_y -= 5;
if (keycode == 12)
e->angle_z += 5;
if (keycode == 0)
e->angle_z -= 5;
}
int key_draw(int keycode, t_env *e)
{
if (keycode == 53)
exit(1);
if (keycode == 24)
e->scale += 1;
if (keycode == 27)
{
if (e->scale != 0)
e->scale -= 1;
}
change_angle(keycode, e);
if (keycode == 13)
e->depth += 0.1;
if (keycode == 1)
e->depth -= 0.1;
if (keycode == 49)
i_will_init(e);
guess_color(keycode, e);
draw_each_frame(e);
return (-1);
}