-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor_buttons.c
67 lines (62 loc) · 1.64 KB
/
color_buttons.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color_buttons.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asoroka <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/12 15:11:31 by asoroka #+# #+# */
/* Updated: 2017/04/12 20:29:31 by asoroka ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
static void set_red(t_fdf *fdf)
{
if (fdf->flag_r == 0)
{
fdf->flag_r = 1;
fdf->flag_g = 0;
fdf->flag_b = 0;
}
foreachpoint(fdf, colorise);
}
static void set_green(t_fdf *fdf)
{
if (fdf->flag_g == 0)
{
fdf->flag_r = 0;
fdf->flag_g = 1;
fdf->flag_b = 0;
}
foreachpoint(fdf, colorise);
}
static void set_blue(t_fdf *fdf)
{
if (fdf->flag_b == 0)
{
fdf->flag_r = 0;
fdf->flag_g = 0;
fdf->flag_b = 1;
}
foreachpoint(fdf, colorise);
}
void color_buttons(int keycode, t_fdf *fdf)
{
if (keycode == 10)
{
fdf->color_coef = (fdf->color_coef < 100) ? fdf->color_coef + 1 : 0;
foreachpoint(fdf, colorise);
}
if (keycode == 15)
{
set_red(fdf);
}
if (keycode == 5)
{
set_green(fdf);
}
if (keycode == 11)
{
set_blue(fdf);
}
}