-
Notifications
You must be signed in to change notification settings - Fork 0
/
color.c
63 lines (58 loc) · 1.91 KB
/
color.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* color.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: emende <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/04 16:25:51 by emende #+# #+# */
/* Updated: 2022/04/09 21:42:54 by emende ### ########.fr */
/* */
/* ************************************************************************** */
#include "fdf.h"
void initilize_colors(t_vars *v)
{
v->color_theme = 1;
v->colors[0][0] = 0xf4b41a;
v->colors[0][1] = 0x143d59;
v->colors[1][0] = 0xe71989;
v->colors[1][1] = 0xffe042;
v->colors[2][0] = 0xed335f;
v->colors[2][1] = 0xf9858b;
v->colors[3][0] = 0x603601;
v->colors[3][1] = 0xebc999;
v->colors[4][0] = 0x22577e;
v->colors[4][1] = 0x999999;
v->light_switch = 0;
v->colormode[0] = 0x121212;
v->colormode[1] = 0xececec;
}
void change_colortheme(int keycode, t_vars *v)
{
if (keycode == 8 || keycode == 99)
{
if (v->color_theme == 4)
v->color_theme = 0;
else
v->color_theme++;
}
if (keycode == 37 || keycode == 108)
{
if (v->light_switch == 0)
v->light_switch = 1;
else
v->light_switch = 0;
}
}
int upd_col(int point1, int point2, t_vars *v)
{
double point1_z;
double point2_z;
point1_z = point1 * v->z_ofs * v->z_ofs2;
point2_z = point2 * v->z_ofs * v->z_ofs2;
if (point1_z == 0 && point2_z == 0)
v->color = v->colors[v->color_theme][1];
else
v->color = v->colors[v->color_theme][0];
return (1);
}