-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfractals.c
57 lines (52 loc) · 1.58 KB
/
fractals.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractals.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vroussea <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/07/26 19:09:06 by vroussea #+# #+# */
/* Updated: 2016/09/06 19:30:45 by vroussea ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
#include <mlx.h>
static void iterate(void (*funct)(int, int, t_env *), t_env *env)
{
int x;
int y;
x = 0;
while (x < env->sx)
{
y = 0;
while (y < env->sy)
{
funct(x, y, env);
y++;
}
x++;
}
mlx_put_image_to_window(env->mlx, env->win, env->img, 1, 1);
if (env->is_text == 1)
{
if (env->fract == 1 || env->fract == 3)
special_text(env);
text(env);
}
hud_text(env);
}
void fractals(t_env *env)
{
void (*funct)(int, int, t_env *);
if (env->fract == 0)
funct = &mandelbrot;
if (env->fract == 1)
funct = &julia;
if (env->fract == 2)
funct = &burning;
if (env->fract == 3)
funct = &julol;
if (env->fract == 4)
funct = &mandeldeux;
iterate(funct, env);
}