void mlx_var(t_env *init, char *av) { init->mlx = mlx_init(); ft_initenv(init, av); init->win = mlx_new_window(init->mlx, init->width, init->height, "RTV1"); init->img = ft_init_img(init, init->width, init->height); //mlx_hook(init->win, 6, 0, mouse_hook, init); mlx_hook(init->win, 2, 0, key_hook, init); //mlx_expose_hook(init->win, expose_hook, init); //mlx_loop_hook(init->mlx, loop_hook, init); mlx_loop(init->mlx); }
static void ft_initenv(t_env *init, char *av) { init->fract = av; init->x1 = -1.5; init->x2 = 1.5; init->y1 = -1.5; init->y2 = 1.5; init->width = (init->x2 - init->x1) * 200; init->height = (init->y2 - init->y1) * 200; init->iter = 30; init->julx = 0; init->july = 0; init->movex = 0; init->movey = 0; init->zoom = 1; init->fixjul = 0; init->col = 0x0f0fff; init->img = ft_init_img(init); }
void *ft_mlx(void *p_data) { t_env *e; e = (t_env *)p_data; e->graph.mlx = mlx_init(); if (e->graph.mlx != NULL) e->graph.win = mlx_new_window(e->graph.mlx, WIN_SIZE_X, WIN_SIZE_Y, TITLE); if (e->graph.mlx && e->graph.win) { ft_init_img(e); e->graph.status = 1; mlx_expose_hook(e->graph.win, &expose, e); mlx_loop_hook(e->graph.mlx, &expose_loop, e); mlx_do_key_autorepeaton(e->graph.mlx); mlx_hook(e->graph.win, 2, (1L << 0), ft_button, e); mlx_loop(e->graph.mlx); } return (NULL); }