-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfdf.h
162 lines (134 loc) · 2.82 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: conguyen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/14 12:19:43 by conguyen #+# #+# */
/* Updated: 2022/03/25 13:17:03 by conguyen ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FDF_H
# define FDF_H
# include "mlx_linux/mlx.h"
//# include <mlx.h>
//#include "key_define_macschool.h"
# include "key_define.h"
# include <stdlib.h>
# include "libft/libft.h"
# include <stdio.h>
# include <math.h>
typedef struct s_data
{
void *mlx;
void *win;
void *img;
char *addr;
int bits_per_pixel;
int line_length;
int endian;
} t_data;
typedef struct s_map
{
int **map;
int **color;
int width;
int height;
int max;
int min;
int curr_h;
int next_h;
} t_map;
typedef struct s_winsize
{
int w;
int h;
} t_winsize;
typedef struct s_linedata
{
double x1;
double y1;
double z;
double x2;
double y2;
int dx;
int dy;
int pad_h;
int pad_w;
int curr_color;
int next_color;
} t_linedata;
typedef struct s_color
{
int r;
int g;
int b;
} t_color;
typedef struct s_flags
{
double h;
double h_modifier;
int zoom;
int vert;
int hori;
double proj_y;
double proj_x;
double para_y;
double isom_x;
double pad_modifier;
int projection;
int color;
} t_flags;
typedef struct s_fdf
{
t_data mlx;
t_map map;
t_winsize winsize;
t_flags flag;
t_linedata px;
} t_fdf;
/*
** draw.c
*/
void my_mlx_pixel_put(t_fdf *fdf, int x, int y, int color);
void clear_image(t_fdf *fdf);
void render_image(t_fdf *fdf);
void draw_helper(t_fdf *fdf);
/*
** events.c
*/
int events(int keycode, t_fdf *fdf);
/*
** draw_image.c
*/
void draw_image(t_fdf *fdf);
/*
** draw_line.c
*/
void draw_line_dx(t_fdf *fdf, t_linedata px, int check);
void draw_line_dy(t_fdf *fdf, t_linedata px, int check);
/*
** parser.c
*/
void transform_array(char *lines, t_fdf *fdf);
/*
** parser_check.c
*/
void free_str_arr(char **arr);
void check_line(char **line);
void check_width(char **lines_arr, t_fdf *fdf, int x);
/*
** color_parser.c
*/
int check_color_line(char *line, t_fdf *fdf, int x);
/*
** color.c
*/
int color_flag(t_fdf *fdf, int mod, int distance);
/*
** exit.c
*/
int exit_fdf(t_fdf *fdf);
void error_exit(char **lines);
#endif