-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfractol.h
132 lines (108 loc) · 3.27 KB
/
fractol.h
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractol.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jfortin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/03/08 18:24:22 by jfortin #+# #+# */
/* Updated: 2016/03/18 22:33:41 by jfortin ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FRACTOL_H
# define FRACTOL_H
# include "libft/includes/libft.h"
# include <mlx.h>
# include <math.h>
# define WIN_X 1050
# define IM_X 800
# define WIN_Y 600
# define KEYPRESS 2
# define KEYRELEASE 3
# define KEYPRESSMASK (1L<<0)
# define KEYRELEASEMASK (1L<<1)
# define POINTERMOTIONMASK (1L<<6)
# define MOTIONNOTIFY 6
# define ESC 53
# define PLUS 69
# define MINUS 78
# define NUM_ZERO 82
# define ZERO 29
# define SPACE 49
# define ONE 18
# define TWO 19
# define THREE 20
# define FOUR 21
# define WELCOME "Welcome to FRACTOL by jfortin"
# define PRESS " Press any key to start "
# define CONTROLS " CONTROLS "
# define H_L_CLICK " zoom in | L click"
# define H_R_CLICK " zoom out | R click"
# define H_PLUS " add iter | + "
# define H_MINUS " sub iter | - "
# define H_ZERO " reset | 0 "
# define H_NUM " change frac | 1-2-3-4"
# define H_ESC " exit | esc "
# define H_SPACE1 " pause the | "
# define H_SPACE2 " modification| space "
# define H_SPACE3 " of julia | "
# define H_JULIA1 " move the mouse "
# define H_JULIA2 " to change the "
# define H_JULIA3 " shape of the fractal"
typedef struct s_env
{
void *mlx;
void *win;
char *av;
void *im;
char *imc;
int bpp;
int imlen;
int endi;
int i;
int x;
int y;
float x1;
float x2;
float y1;
float y2;
int iter_max;
int im_x;
int im_y;
float c_r;
float c_i;
float z_r;
float z_i;
float tmp;
float zoom;
float zoom_x;
float zoom_y;
int itm;
int reset;
int bj;
int check;
float tmpx;
float tmpy;
float tmpx2;
float tmpy2;
} t_env;
void ft_ini_fract(t_env *e);
void ft_ini_val_mandelbrot(t_env *e);
void ft_ini_val_julia(t_env *e);
void ft_ini_val_bship(t_env *e);
void ft_ini_val_mandelbis(t_env *e);
void ft_print_fract(t_env *e);
void ft_print_mandel(t_env *e);
void ft_print_julia(t_env *e);
void ft_print_bship(t_env *e);
void ft_print_mandelbis(t_env *e);
int ft_core(t_env *e);
int ft_key_hit(int keycode, t_env *e);
int ft_key_release(int keycode, t_env *e);
void ft_do_key_ation(t_env *e);
void ft_put_pixel(t_env *e, int x, int y, int color);
void ft_settings(t_env *e);
void ft_arg_error(void);
int ft_mouse_hook(int keycode, int x, int y, t_env *e);
int ft_julia_hook(int x, int y, t_env *e);
#endif