-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfractol_init.c
54 lines (50 loc) · 1.98 KB
/
fractol_init.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractol_init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbozhko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/07/21 16:31:46 by rbozhko #+# #+# */
/* Updated: 2018/07/21 19:09:54 by rbozhko ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
t_pft *ft_handle_fractol(void)
{
t_pft *fractol_ptr;
fractol_ptr = (t_pft*)malloc(sizeof(t_pft) * FRACTOL_NUM);
fractol_ptr[0] = mandelbrot;
fractol_ptr[1] = io;
fractol_ptr[2] = ship;
fractol_ptr[3] = julia;
fractol_ptr[4] = newton;
fractol_ptr[5] = NULL;
return (fractol_ptr);
}
void fractol_init(int fractol_num, t_map *map)
{
map->pause = false;
map->speed = 1;
map->x_offset = 0;
map->y_offset = 0;
map->julia_coef_x = 0;
map->julia_coef_y = 0;
map->mouse_x = 0;
map->mouse_y = 0;
map->zoom = 1;
map->iter = 0;
map->max_iter = ITER_START;
map->f_num = fractol_num;
map->mlx_ptr = mlx_init();
map->win_ptr = mlx_new_window(map->mlx_ptr, map->win_width,
map->win_height, "Fractol");
map->img_ptr = mlx_new_image(map->mlx_ptr, map->win_width,
map->win_height);
map->str = (unsigned char*)mlx_get_data_addr(map->img_ptr,
&map->bpp, &map->sl, &map->endian);
map->function = ft_handle_fractol();
// BY changing last three parameters (rgb) we can change fractol's color
//map->pltt = (t_color){0.3F, 128, 127, 2, 0, 4};
map->pltt = (t_color){0.3F, 128, 127, 5, 1, 2};
}