-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.c
46 lines (40 loc) · 1.53 KB
/
event.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* event.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mikus <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/05/01 18:33:42 by vbraeke #+# #+# */
/* Updated: 2016/05/03 00:03:10 by mikus ### ########.fr */
/* */
/* ************************************************************************** */
#include "all.h"
void draw_img(t_env *e)
{
int n;
n = e->x * e->bpp / 8 + e->y * e->len;
e->data[n] = e->r;
e->data[n + 1] = e->g;
e->data[n + 2] = e->b;
}
void ft_reset(t_env *e)
{
(e->ftype == 1) ? init_mandle(e) : 0;
(e->ftype == 2) ? init_julia(e) : 0;
(e->ftype == 3) ? init_boat(e) : 0;
(e->ftype == 4) ? init_mix(e) : 0;
}
void init_mlx(t_env *e)
{
e->mlx = mlx_init();
e->img = mlx_new_image(e->mlx, 500, 500);
e->data = mlx_get_data_addr(e->img, &e->bpp, &e->len, &e->endian);
e->win = mlx_new_window(e->mlx, 500, 500, "Fractol");
}
void set_color(t_env *e)
{
e->r = e->i * 255 / e->max;
e->g = e->i * 255 / e->max;
e->b = e->i * 255 / e->max;
}