-
Notifications
You must be signed in to change notification settings - Fork 0
/
fdf.h
100 lines (86 loc) · 2.5 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lumaret <lumaret@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/15 14:28:29 by lumaret #+# #+# */
/* Updated: 2024/09/25 15:30:58 by lumaret ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FDF_H
# define FDF_H
# include "libft/libft.h"
# include "minilibx/mlx.h"
# include <math.h>
# include <stdio.h>
# include <stdlib.h>
# define ESC 65307
# define LEFT 65361
# define RIGHT 65363
# define UP 65362
# define DOWN 65364
# define PAGE_UP 65365
# define PAGE_DOWN 65366
# define ZOOM 61
# define DEZOOM 45
# define SPACE 32
# define W 119
# define A 97
# define S 115
# define D 100
# define BASE_SCALE 30
typedef struct s_fdf
{
char **map;
void *mlx_ptr;
void *win_ptr;
void *img;
void *addr;
int *map_size;
int bpp;
int ll;
int endian;
int win_width;
int win_height;
int scale;
int start_x;
int start_y;
int map_height;
int x;
int y;
int z;
} t_fdf;
typedef struct s_line
{
int dx;
int dy;
int err;
int x0;
int y0;
int sx;
int sy;
} t_line;
int get_arr_length(char *line, t_fdf *fdf);
int draw(t_fdf *fdf);
int *iso_proj(t_fdf *fdf, int x, int y, int z);
char **init_parsing(t_fdf *fdf, char *file_name);
void init_everything(char *map, t_fdf *fdf);
void free_map(char **map);
void free_splits(char ***splits, int size);
void free_mlx(t_fdf *fdf);
void redraw(t_fdf *fdf);
int *map_checker(t_fdf *fdf, char **map);
void set(t_fdf *fdf);
int get_x(t_fdf *fdf, int x);
int get_y(t_fdf *fdf, int y, int scale);
void draw_vertical(t_fdf *fdf);
void draw_horizontal(t_fdf *fdf, char **split, int y1);
void iso_movement(t_fdf *fdf, int direction);
void zoom_handler(t_fdf *fdf, int direction);
void change_z(t_fdf *fdf, int key);
void malloc_exit(t_fdf *fdf);
void drawline(t_fdf *fdf, int *start, int *end);
void my_pixel_put_img(t_fdf *fdf, int x, int y);
#endif