-
Notifications
You must be signed in to change notification settings - Fork 0
/
fdf.h
145 lines (135 loc) · 3.35 KB
/
fdf.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
133
134
135
136
137
138
139
140
141
142
143
144
145
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jgourdin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/09/13 01:42:52 by jgourdin #+# #+# */
/* Updated: 2017/10/04 01:34:36 by jgourdin ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FDF_H
# define FDF_H
# include <math.h>
# include <stdlib.h>
# include <fcntl.h>
# include <stdio.h>
# include "./minilibx_macos/mlx.h"
# include "./libft/libft.h"
# define INIT env->mlx.init
# define WIN env->mlx.window
# define WIDTH env->largeur
# define HEIGHT env->hauteur
# define DATA env->mlx.data
# define IMAGE env->mlx.image
# define BPP env->mlx.bpp
# define SIZE env->mlx.size_line
# define ENDIAN env->mlx.endian
# define ZOOM env->options.zoom
# define HORIZ env->options.horiz
# define VERTI env->options.verti
# define MAP env->map.map
# define DATA env->mlx.data
# define COLOR env->options.color
# define COS cos(M_PI * env->options.angle / 180)
# define SIN sin(M_PI * env->options.angle / 180)
# define X0 env->x0
# define X1 env->x1
# define Y0 env->y0
# define Y1 env->y1
# define XMAX env->xmax
# define YMAX env->ymax
# define BASEX env->basex
# define BASEY env->basey
# define ZMAX env->zmax
# define DX env->calc.dx
# define SX env->calc.sx
# define DY env->calc.dy
# define SY env->calc.sy
# define ERR env->calc.err
# define ZED env->options.zed
# define ANGLE env->options.angle
# define COLORTMP env->options.colortmp
# define COLORTMP2 env->options.colortmp2
# define AP 81
# define AM 75
# define ESC 53
# define UP 126
# define DOWN 125
# define RIGHT 124
# define LEFT 123
# define PLUS 69
# define MINUS 78
typedef struct s_mlx
{
void *init;
void *window;
void *image;
char *data;
int bpp;
int size_line;
int endian;
} t_mlx;
typedef struct s_options
{
int horiz;
int verti;
int zoom;
int angle;
int color;
int zed;
int colortmp;
int colortmp2;
} t_options;
typedef struct s_calc
{
int dx;
int sx;
int dy;
int sy;
int err;
int e2;
} t_calc;
typedef struct s_map
{
int nbr_lines;
int fd;
int **map;
} t_map;
typedef struct s_fdf
{
int largeur;
int hauteur;
int xmax;
int ymax;
int zmax;
int xmin;
int ymin;
int zmin;
int basex;
int basey;
int x0;
int rd;
int fd;
int c;
int y0;
int x1;
int y1;
t_mlx img;
t_map map;
t_options options;
t_mlx mlx;
t_calc calc;
} t_fdf;
void mlx_pixel_image(t_fdf *env, int x, int y);
void calc_line(t_fdf *env);
int dif_point(int x, int y, t_fdf *env);
int lauchfactory(t_fdf *env);
int *atoi_feed(char **line, t_fdf **env);
void init(t_fdf **env);
int count(t_fdf **env, char *file);
int main(int argc, char *argv[]);
void ft_info(t_fdf *env);
int k_hook(int keycode, t_fdf *env);
#endif