int ft_event_key(int key, t_env *env) { if (key == KEY_ESCAPE) ft_exit(&env->mlx); else if (key == ARROW_UP || key == ARROW_DOWN || key == ARROW_RIGHT || key == ARROW_LEFT) ft_move_mandelbrot(key, env); else if (key == 113) printf(C_GREEN"On lit les donnees : zoom{%d}, iterate{%d} X1{%f} X2{%f} Y1{%f} Y2{%f}"C_NONE"\n", env->fract.zoom, env->fract.iterate, env->fract.area.xy1.x, env->fract.area.xy2.x, env->fract.area.xy1.y, env->fract.area.xy2.y); else if (key == 49) env->fract.cst_zoom = 0.5; else if (key == 50) env->fract.cst_zoom = 0.1; else if (key == 51) env->fract.cst_zoom = 0.01; else if (key == 52) env->fract.cst_zoom = 0.001; else if (key == 48) { ft_bzero(env->mlx.data, env->mlx.sizeline * env->height); ft_bzero(env->mlx.data_tmp, env->mlx.sizeline * env->height); ft_mandelbrot(env->fract, env); } printf(C_GREEN"On lit les donnees : key{%d}\n", key); return (0); }
int ft_draw(t_mlx *mlx) { int x; int y; int color; y = 0; while (y < WIN_H) { x = 0; while (x < WIN_W) { if (mlx->f->nb == 1) color = ft_color(ft_julia(mlx, x, y), mlx); else if (mlx->f->nb == 2) color = ft_color(ft_mandelbrot(mlx, x, y), mlx); else if (mlx->f->nb == 3) color = ft_color(ft_tricorn(mlx, x, y), mlx); put_pixel(mlx->f, x, y, color); x++; } y++; } mlx_put_image_to_window(mlx->mlx, mlx->win, mlx->f->img, 0, 0); return (0); }
void ft_fractal(t_env *env) { env->image_x = (env->x2 - env->x1) * env->zoom; env->image_y = (env->y2 - env->y1) * env->zoom; if (env->image_x > env->win_h * 4) env->image_x = env->win_h; if (env->image_y > env->win_l) env->image_y = env->win_l; if (env->mandelbrot == 1) ft_mandelbrot(env); if (env->julia == 1) ft_julia(env); if (env->droit == 1) ft_droit(env); if (env->burnship == 1) ft_burnship(env); if (env->tricorne == 1) ft_tricorne(env); }
int main(int ac, char **av) { if (ac == 1) { ft_putstr("\nFractales disponibles:\nJulia\nMan\nMan2\n"); return (0); } if (ac == 2) { if (ft_strcmp(av[1], "Julia") == 0) ft_julia(); else if (ft_strcmp(av[1], "Man") == 0) ft_mandelbrot(); else if (ft_strcmp(av[1], "Man2") == 0) ft_mandelbrot2(); else ft_putstr("\nFractales disponibles:\nJulia\nMan\nMan2\n"); } return (0); }
void ft_draw(t_fractol *e) { ft_bzero(e->data, e->s_l * HEIGHT); e->x = 0; while (e->x < WIDTH) { e->y = 0; while (e->y < HEIGHT) { if (e->fractal == 1) ft_mandelbrot(e); else if (e->fractal == 2) ft_julia(e); else if (e->fractal == 3) ft_burningship(e); else if (e->fractal == 4) ft_douady(e); e->y++; } e->x++; } mlx_put_image_to_window(e->mlx, e->win, e->img, 0, 0); ft_info(e); }