Comments in header file

This commit is contained in:
Angel Ortigosa Perez
2026-01-25 14:31:07 +01:00
parent fc5ff31806
commit edc4144d38

View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */ /* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/25 19:47:02 by aortigos #+# #+# */ /* Created: 2025/11/25 19:47:02 by aortigos #+# #+# */
/* Updated: 2025/12/15 10:27:21 by aortigos ### ########.fr */ /* Updated: 2026/01/25 14:30:55 by aortigos ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -42,6 +42,7 @@
# define ERR_MAP_DUP "Error: duplicate map element\n" # define ERR_MAP_DUP "Error: duplicate map element\n"
# define ERR_MAP_RGB "Error: invalid color map [RGB]\n" # define ERR_MAP_RGB "Error: invalid color map [RGB]\n"
// Storage for textures that we will use
typedef struct s_tex typedef struct s_tex
{ {
mlx_texture_t *no; mlx_texture_t *no;
@@ -50,6 +51,9 @@ typedef struct s_tex
mlx_texture_t *ea; mlx_texture_t *ea;
} t_tex; } t_tex;
// Temporal storage for checking textures
// so we dont load it as real texture, in case
// of failing. First check, then load as texture.
typedef struct s_texture_list typedef struct s_texture_list
{ {
char *name; char *name;
@@ -57,17 +61,19 @@ typedef struct s_texture_list
struct s_texture_list *next; struct s_texture_list *next;
} t_texture_list; } t_texture_list;
// Storage for player data
typedef struct s_player typedef struct s_player
{ {
int plyr_x; // player x position in pixels int plyr_x;
int plyr_y; // player y position in pixels int plyr_y;
double angle; // player angle double angle;
float fov_rd; // field of view in radians float fov_rd;
int rot; // rotation flag int rot;
int l_r; // left right flag int l_r;
int u_d; // up down flag int u_d;
} t_player; } t_player;
// Storage for raycasting properties
typedef struct s_ray typedef struct s_ray
{ {
int index; int index;
@@ -80,12 +86,13 @@ typedef struct s_ray
int flag; int flag;
} t_ray; } t_ray;
// Map data
typedef struct s_data typedef struct s_data
{ {
int p_x; // player x position in the map int p_x;
int p_y; // player y position in the map int p_y;
int w_map; // map width int w_map;
int h_map; // map height int h_map;
int fd; int fd;
char *line; char *line;
char *ture; char *ture;
@@ -98,20 +105,20 @@ typedef struct s_data
t_texture_list *t_list; t_texture_list *t_list;
} t_data; } t_data;
// All global data in one unique structure
typedef struct s_mlx typedef struct s_mlx
{ {
mlx_image_t *img; // the image mlx_image_t *img;
mlx_t *mlx_ptr; // the mlx pointer mlx_t *mlx_ptr;
t_ray *ray; // the ray structure t_ray *ray;
t_data *dt; // the data structure t_data *dt;
t_player *ply; // the player structure t_player *ply;
t_tex *tex; t_tex *tex;
t_texture_list *l_ture; t_texture_list *l_ture;
} t_mlx; } t_mlx;
// Functions // Functions
// parsing.c // parsing.c
int read_map(char *av, t_data *map, int *count); int read_map(char *av, t_data *map, int *count);
void get_x_y_player(t_data *data); void get_x_y_player(t_data *data);