-
Notifications
You must be signed in to change notification settings - Fork 0
/
fdf_bonus.h
133 lines (111 loc) · 2.84 KB
/
fdf_bonus.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf_bonus.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: junyojeo <junyojeo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 20:20:14 by junyojeo #+# #+# */
/* Updated: 2023/05/19 01:09:01 by junyojeo ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FDF_BONUS_H
# define FDF_BONUS_H
# include "libft.h"
# include "get_next_line.h"
# include "lib/mlx/mlx.h"
# include <math.h>
# include <unistd.h>
# include <fcntl.h>
/* SCREEN SIZE */
# define SCRN_WIDTH 1920
# define SCRN_HEIGHT 1080
/* COLOR */
# define CLR_CHROME_YELLOW 0xFFA700
# define CLR_VIVA_MAGENTA 0xBB2649
# define CLR_DEFAULT 0xFFFFFF
/* PARALLEL_MOVEMENT */
# define ORIGIN 1
/* KEY_MACRO */
# define KEY_RED_CROSS 17
# define KEY_RED_CROSS 17
# define KEY_ESCAPE 53
# define KEY_W 13
# define KEY_A 0
# define KEY_S 1
# define KEY_D 2
# define KEY_U 32
# define KEY_J 38
# define KEY_I 34
# define KEY_K 40
# define KEY_O 31
# define KEY_L 37
# define KEY_MINUS 27
# define KEY_EQUAL 24
# define KEY_SPACE 49
typedef enum e_projection
{
PARALLE,
ISO
} t_projection;
typedef struct s_point
{
int x;
int y;
int z;
int color;
} t_point;
typedef struct s_map
{
t_point **dot;
int width;
int height;
} t_map;
typedef struct s_mlx
{
void *mlx;
void *win;
void *img;
char *addr;
int bits_per_pixel;
int line_length;
int endian;
int offset_x;
int offset_y;
float alpha;
float beta;
float gamma;
int zoom;
t_projection projection;
t_map map;
} t_mlx;
typedef struct s_bresenham
{
int w;
int h;
int increment_x;
int increment_y;
} t_bresenham;
/* functions */
void fdf(char **argv);
/* init */
void init(t_mlx *mlx, char *argv);
/* parse */
void parse(t_map *map, char *argv);
/* draw */
void draw(t_mlx *mlx);
void pixel_put(t_mlx *mlx, t_point *p);
void parallel_movement(t_map *map, int flag);
void bresenham(t_mlx *mlx, t_point start, t_point end);
/* utils */
void ft_puterror(char *str);
int ft_atoi_base(char *str);
/* key_hook */
void ft_hook(t_mlx *mlx);
int my_key_hook(int key, t_mlx *mlx);
int key_press(int key_symbol, t_mlx *mlx);
int red_cross(t_mlx *mlx);
void rotate_x(int *y, int *z, double alpha);
void rotate_y(int *x, int *z, double beta);
void rotate_z(int *x, int *y, double gamma);
#endif