RhumScorpio / cub3d

MIT License
0 stars 0 forks source link

get data from input file #1

Open RhumScorpio opened 1 year ago

RhumScorpio commented 1 year ago

In the first place, we will open, read and parse the .cub file. This file shall contain the following data :

All the above shall be stored in the following data structures :

typedef struct s_player t_player;

struct s_player
{
    size_t  pos[2];
    double  direction;
};
typedef struct s_image  t_image;

struct s_image
{
    void    *ptr;
    uint32_t    *addr;
    uint16_t    width;
    uint16_t    height;
    uint16_t    bpp;
    uint16_t    line_len;
    uint16_t    endian;
};
typedef struct s_map    t_map;

struct s_map
{
    t_image wall_textures[4];
    uint32_t    floor_color;
    uint32_t    ceiling_color;
    char    **raw_map;

};
typedef struct t_game   t_game;

struct s_game
{
    t_player    player;
    t_map   map;
};
JonathanDUFOUR commented 1 year ago

We should add a field in the t_map data structure to also store the raw map as an array of characters.

JonathanDUFOUR commented 1 year ago

Also, I suggest that we use verbose type aliases, so we would put t_image instead of t_img.

RhumScorpio commented 1 year ago

Last week I added 42 ft_count_line, Doxygen Documentation Generator and Todo Tree plugins to my Virtual Studio Code. This will help being more clean and structured. I also added the Vim plugin until I learn fully how to use VSCode. Up next is the part of the parsing where I open the file.