/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fractol_init.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gtertysh +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/16 18:55:39 by gtertysh #+# #+# */ /* Updated: 2017/03/16 18:56:00 by gtertysh ### ########.fr */ /* */ /* ************************************************************************** */ #include "fractol.h" static t_mw *mlx_and_win_ptr_init(int x, int y) { t_mw *mw; if ((mw = malloc(sizeof(t_mw)))) { mw->mlx = mlx_init(); mw->win = mlx_new_window(mw->mlx, x, y, "FRCTL"); } return (mw); } t_julia *jul_init(void) { t_julia *j; j = malloc(sizeof(t_julia)); complex_equal(-0.7, 0.27015, &j->jul_const); j->max_iterations = JUL_MAX_ITER; j->mov.x = 0; j->mov.y = 0; j->mov.z = 1; return (j); } t_fractals *frac_init(void) { t_fractals *f; f = malloc(sizeof(t_fractals)); f->jul = jul_init(); return (f); } t_fractol *fractol_init(void) { t_fractol *fractol; if ((fractol = malloc(sizeof(t_fractol)))) { fractol->w_height = HEIGHT; fractol->w_width = WIDTH; fractol->fractals = frac_init(); fractol->mw = mlx_and_win_ptr_init(WIDTH, HEIGHT); fractol->image = NULL; } return (fractol); }