-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfractol.c
70 lines (66 loc) · 2.73 KB
/
fractol.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractol.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yait-iaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/06 15:31:42 by yait-iaz #+# #+# */
/* Updated: 2022/01/15 20:45:23 by yait-iaz ### ########.fr */
/* */
/* ************************************************************************** */
#include "fract.h"
int red_cross(t_display *mlx)
{
mlx_destroy_window(mlx->init, mlx->win);
free(mlx->color);
free(mlx->img);
free(mlx);
exit(0);
}
void mandelbrot(t_display *mlx)
{
mlx = mlx_initialization();
mlx->init = mlx_init();
mlx->win = mlx_new_window(mlx->init, SIDE, SIDE, "Fractol D Ma3ert");
mlx->img->img = mlx_new_image(mlx->init, SIDE, SIDE);
mlx->img->addr = mlx_get_data_addr(mlx->img->img, \
&mlx->img->bpp, &mlx->img->line_len, &mlx->img->endian);
mlx->fract = 1;
mlx_hook(mlx->win, 2, 1L << 0, &key_event, mlx);
mlx_hook(mlx->win, 17, 0, &red_cross, mlx);
mlx_hook(mlx->win, 4, 1L << 2, &mouse_event, mlx);
mlx_loop_hook(mlx->init, &hundle_no_event, mlx);
mlx_loop(mlx->init);
}
void julia(t_display *mlx)
{
mlx = mlx_initialization();
mlx->init = mlx_init();
mlx->win = mlx_new_window(mlx->init, SIDE, SIDE, "Fractol D Ma3ert");
mlx->img->img = mlx_new_image(mlx->init, SIDE, SIDE);
mlx->img->addr = mlx_get_data_addr(mlx->img->img, \
&mlx->img->bpp, &mlx->img->line_len, &mlx->img->endian);
mlx->fract = 2;
mlx_hook(mlx->win, 2, 1L << 0, &key_event, mlx);
mlx_hook(mlx->win, 17, 0, &red_cross, mlx);
mlx_hook(mlx->win, 4, 1L << 2, &mouse_event, mlx);
mlx_hook(mlx->win, 6, 1L << 0, &mouse_cord, mlx);
mlx_loop_hook(mlx->init, &hundle_no_event, mlx);
mlx_loop(mlx->init);
}
void burning_ship(t_display *mlx)
{
mlx = mlx_initialization();
mlx->init = mlx_init();
mlx->win = mlx_new_window(mlx->init, SIDE, SIDE, "Fractol D Ma3ert");
mlx->img->img = mlx_new_image(mlx->init, SIDE, SIDE);
mlx->img->addr = mlx_get_data_addr(mlx->img->img, \
&mlx->img->bpp, &mlx->img->line_len, &mlx->img->endian);
mlx->fract = 3;
mlx_hook(mlx->win, 17, 0, &red_cross, mlx);
mlx_hook(mlx->win, 2, 1L << 0, &key_event, mlx);
mlx_hook(mlx->win, 4, 1L << 2, &mouse_event, mlx);
mlx_loop_hook(mlx->init, &hundle_no_event, mlx);
mlx_loop(mlx->init);
}