aboutsummaryrefslogtreecommitdiffstats
path: root/inc/cub3d_structs.h
blob: 08fc8144f3c0d55c905b8c6b249a54eb301b0f63 (plain)
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
#ifndef CUB3D_STRUCTS_H
#define CUB3D_STRUCTS_H

typedef struct		s_win
{
	void			*wlx;
	void			*winptr;
	uint8_t			inited;
	uint16_t		x_max_size;
	uint16_t		y_max_size;
	uint16_t		x_size;
	uint16_t		y_size;
}					t_win;

typedef struct		s_img
{
	void			*img;
	char			*ptr;
	int				bpp;
	int				sizeline;
	int				endian;
}					t_img;

typedef struct		s_rgb
{
	int16_t			r;
	int16_t			g;
	int16_t			b;
}					t_rgb;

/*
** player view_side:
** 1: North
** 2: East
** 3: South
** 4: West
*/

typedef struct		s_player
{
	float			pos_x;
	float			pos_y;
	float			view_side;
	float			dir_x;
	float			dir_y;
	float			cam_x;
	float			plane_x;
	float			plane_y;
}					t_player;

typedef struct		s_ray
{
	uint16_t		line_h;
	float			wall_dist;
	float			x_ray_pos;
	float			y_ray_pos;
	float			x_ray_dir;
	float			y_ray_dir;
	float			x_side_dist;
	float			y_side_dist;
	float			x_delta_dist;
	float			y_delta_dist;
	int16_t			wall_t;
	int16_t			wall_b;
	uint8_t			side;
	size_t			sqx;
	size_t			sqy;
	uint8_t			hit;
}					t_ray;

typedef struct		s_map
{
	char			*no_tex_path;
	char			*so_tex_path;
	char			*ea_tex_path;
	char			*we_tex_path;
	char			*sprite_path;
	char			*mapl;
	char			**map;
	int8_t			x_step;
	int8_t			y_step;
	size_t			map_w;
	size_t			map_h;
	size_t			line_chk;
	size_t			map_start;
	uint8_t			isspawn;
	uint8_t			scale;
}					t_map;

typedef struct		s_cub
{
	uint8_t			minimap;
	struct s_win	*wlist;
	struct s_player	*plist;
	struct s_map	*mlist;
	struct s_ray	rlist;
	struct s_img	img;
	struct s_rgb	f_rgb;
	struct s_rgb	c_rgb;
}					t_cub;

#endif