-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyboard1.c
48 lines (44 loc) · 1.09 KB
/
keyboard1.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
#include "includes/fractol.h"
void keyboard_julia_motion(t_fractal *fractal)
{
if (fractal->is_julia_motion == OFF)
fractal->is_julia_motion = ON;
else if (fractal->is_julia_motion == ON)
fractal->is_julia_motion = OFF;
}
void keyboard_less_iterations(t_fractal *fractal)
{
if (fractal->max_iteration - ITERATIONS_CHANGE >= ITERATIONS_MIN)
{
fractal->max_iteration -= ITERATIONS_CHANGE;
mlx_clear_window(fractal->window.mlx, fractal->window.win);
draw_fractal(fractal);
}
}
void keyboard_more_iterations(t_fractal *fractal)
{
if (fractal->max_iteration + ITERATIONS_CHANGE <= ITERATIONS_MAX)
{
fractal->max_iteration += ITERATIONS_CHANGE;
mlx_clear_window(fractal->window.mlx, fractal->window.win);
draw_fractal(fractal);
}
}
void keyboard_change_colorset(int keycode, t_fractal *fractal)
{
if (keycode == KEY_ONE)
{
fractal->colorset = COLORSET_GALACTIC;
draw_fractal(fractal);
}
else if (keycode == KEY_TWO)
{
fractal->colorset = COLORSET_RED;
draw_fractal(fractal);
}
else if (keycode == KEY_THREE)
{
fractal->colorset = COLORSET_PSYCHO;
draw_fractal(fractal);
}
}