cub3d/includes/structs.h
2025-07-09 16:45:13 +02:00

80 lines
1.7 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* structs.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/21 19:46:20 by tchampio #+# #+# */
/* */
/* ************************************************************************** */
#ifndef STRUCTS_H
# define STRUCTS_H
# include <stdbool.h>
typedef struct s_mlx_data
{
void *img;
char *addr;
int bits_per_pixel;
int line_length;
int endian;
} t_mlx_data;
typedef enum e_direction
{
NORTH,
SOUTH,
EAST,
WEST
} t_direction;
typedef struct s_mapdata
{
char *filename;
char *no_texture;
char *so_texture;
char *we_texture;
char *ea_texture;
int f_color;
int c_color;
int mapheight;
char **map;
char **mapflood;
int skipped_lines;
bool isvalid;
int startx;
int starty;
t_direction startdirection;
char error[1024];
} t_mapdata;
struct s_playermove {
int is_w_pressed;
int is_a_pressed;
int is_s_pressed;
int is_d_pressed;
};
typedef struct s_player
{
float x;
float y;
double yaw;
int health;
struct s_playermove playermove;
} t_player;
typedef struct s_cub3d_data
{
void *mlx;
void *mlx_win;
t_mlx_data *mlx_data;
t_mapdata *map;
t_player player;
} t_cub3d_data;
#endif