3 ‐ structs and data init - shoganaix/42Cub3d GitHub Wiki

aux

/* color */
typedef struct	s_color
{
	int r;
	int g;
	int b;
} t_color;

/* Cardinal points  / direction */
typedef enum e_card
{
	NO,
	SO,
	WE,
	EA,
	NUM_CARD
} t_card;

/* error */ // ??
typedef enum e_errcode
{
	ERR_OK,
	ERR_xxx,
	...
	NUM_ERR
} t_errcode;

cub - main structures


/* cub info */
typedef struct	s_info
{
	char	*textures[4];
	t_color	floor;
	t_color ceiling;
}   t_info;

/* cub map */
typedef struct	s_map
{
	char	**map;
	int	height;
	int	width;
	... ?
}   t_map;

/* cub */
typedef struct	s_cub
{
	t_info	info;
	t_map	map;
	... ?
}   t_cub;


mlx structures


/* MLX */

typedef struct	s_game {
	void	*mlx;
	void	*win;
} t_game;

typedef struct	s_image
{
	void	*mlximg;
	char	*addr;
	int	bits_per_pixel;
	int	line_size;
	int	endian;
}   t_image;