-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfdf.h
More file actions
161 lines (148 loc) · 4.13 KB
/
Copy pathfdf.h
File metadata and controls
161 lines (148 loc) · 4.13 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ehouzard <ehouzard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/03/15 11:27:00 by ehouzard #+# #+# */
/* Updated: 2018/05/15 18:10:20 by ehouzard ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FDF_H
# define FDF_H
# include <unistd.h>
# include <errno.h>
# include <math.h>
# include "mlx.h"
# include "libft.h"
# include "X.h"
# define BUF_SIZE 900
# define WINDOW_SX 800
# define WINDOW_SY 750
# define IMG_XMAX 800
# define IMG_YMAX 600
# define IMG_TOTAL (IMG_XMAX * IMG_YMAX)
# define WHITE 0xFFFFFF
# define RED 0xFF0000
# define GREEN 0x00FF00
# define BLUE 0x0000FF
# define LIGHTBLUE 0x07B0F0
# define DARKGREEN 0x105A2B
# define LIGHTGREEN 0x3CE196
# define YELLOW 0xFFEA37
# define ORANGE 0xFF4F1A
# define VIOLET 0xD000F0
# define BROWN 0x8B4513
typedef struct s_point
{
int x;
int y;
int z;
int color;
} t_point;
typedef struct s_pflo
{
float x;
float y;
float z;
int color;
} t_pflo;
typedef struct s_max
{
int nbp;
int x;
int y;
int z_min;
int z_max;
int shift_x;
int shift_y;
int *lim;
} t_max;
typedef struct s_limap
{
t_point *coord;
t_max maxi;
} t_limap;
typedef struct s_img
{
void *img;
int *data;
int bpp;
int size_l;
int endian;
} t_img;
typedef struct s_env
{
void *mlx;
void *win;
t_img image;
} t_env;
typedef struct s_event
{
int (*key)();
int (*key2)();
int (*mouse)();
int (*buttonpress)();
int (*buttonrelease)();
} t_event;
typedef struct s_mouse
{
int clic;
float mx;
float my;
} t_mouse;
typedef struct s_col
{
int color;
int mode;
} t_col;
typedef struct s_iso
{
t_env env;
t_pflo *point;
t_limap *map;
t_event event;
t_mouse *move;
t_col *col;
float omega;
float alpha;
float space;
float high;
float grow;
float up;
float shift;
} t_iso;
int ft_error(int ac);
int ft_read(char *arg, t_limap *parsed);
int ft_get_nbrofpoint(int fd, t_max *maxi);
int ft_get_point(int fd, t_limap *parsed, int y);
int ft_fill_coord(t_point *c, char *l, int *i, int cmp);
t_point ft_get_coord(char *num, int x, int y);
void init_coord_point(t_point *coord);
void ft_coordmax(t_limap *parsed);
void init_max_zero(t_max *maxi);
void init_space(t_iso **iso, t_limap *parsed);
void ft_reinit_img(t_iso **iso);
int init_param(t_limap *parsed, t_iso *param);
int fdf_iso(t_limap *parsed);
void env_iso(t_iso **iso);
void direct_knit_operation(t_idx idx, t_iso **iso);
void ft_recalc_coord(t_iso **iso, t_limap *parsed);
void knit_map(t_idx idx, t_iso **hop);
void knit_point_to_point(t_pflo a, t_pflo b, t_iso **hop);
void ft_draw_diago_x(t_pflo p, float m, t_iso **hop);
void ft_draw_diago_y(t_pflo p, float m, t_iso **hop);
void pixel_to_image(t_iso **hop, t_pflo p);
int func_to_turn(int x, int y, t_iso **iso);
int func_to_press(int button, int x, int y, t_iso **iso);
int func_to_release(int button, int x, int y, t_iso **iso);
int my_key_func(int keycode, t_iso **iso);
void my_key_func2(int keycode, t_iso **iso);
void rotation_coeff(int dx, int dy, t_iso **iso);
void texte_menu(t_iso **iso);
void texte_menu2(t_iso **iso);
void set_color_mode(t_iso **iso, t_pflo p);
void color_mode_1(t_iso **iso, t_pflo p);
void color_mode_2(t_iso **iso, t_pflo p);
#endif