-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfdf.h
113 lines (101 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fdf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mhedeon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/26 17:20:42 by mhedeon #+# #+# */
/* Updated: 2018/07/03 17:10:39 by mhedeon ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FDF_H
# define FDF_H
# include <sys/types.h>
# include <sys/uio.h>
# include <fcntl.h>
# include <unistd.h>
# include <mlx.h>
# include <stdlib.h>
# include <math.h>
# include "libft/get_next_line.h"
# include "libft/libft.h"
# include <stdio.h>
# include <string.h>
# define WIN_HEIGHT 1200
# define WIN_WIDTH 2000
# define KEY_ESC 53
# define KEY_ENTER 36
# define KEY_H 4
# define KEY_X 7
# define KEY_Y 16
# define KEY_Z 6
# define KEY_ZOOM_PLUS 69
# define KEY_ZOOM_MINUS 78
# define KEY_MOVE_UP 126
# define KEY_MOVE_DOWN 125
# define KEY_MOVE_LEFT 123
# define KEY_MOVE_RIGHT 124
# define KEY_HEIHGT_PLUS 47
# define KEY_HEIHGT_MINUS 43
typedef struct s_top
{
double x;
double y;
double z;
int c;
} t_top;
typedef struct s_map
{
int width;
int height;
t_top **top;
} t_map;
typedef struct s_view
{
double zoom;
int blur;
double height;
int move_x;
int move_y;
int angle_x;
int angle_y;
int angle_z;
t_top **top;
} t_view;
typedef struct s_img
{
int end;
int bits;
int size;
char *img;
void *img_ptr;
} t_img;
typedef struct s_mlx
{
int help;
void *mlx_ptr;
void *win_ptr;
t_map *map;
t_img *img;
t_view *field;
} t_mlx;
void set_info(t_mlx *mlx);
void destruct(t_mlx *mlx);
int get_width(char **tmp);
void transf_map(t_map *map);
void draw_frame(t_mlx *mlx);
int deal_key(int key, t_mlx *mlx);
void rot(t_map *map, t_view *field);
void zoom(t_map *map, t_view *field);
void move(t_map *map, t_view *field);
int rgb(int s, int e, double d_color);
void height(t_map *map, t_view *field);
int valid_map(char *filename, t_map *map);
int parse_top(t_map *map, char *tmp, int x);
int valid_file(int ac, char **av, t_map *map);
void draw_line(t_mlx *mlx, t_top *s, t_top *e);
void draw_img(t_mlx *mlx, t_img *img, t_map *map);
void draw_map(t_mlx *mlx, t_map *map, t_view *field);
void initial(t_mlx *mlx, t_map *map, t_img *img, t_view *field);
#endif