diff options
Diffstat (limited to 'include/so_long.h')
| -rw-r--r-- | include/so_long.h | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/include/so_long.h b/include/so_long.h index d66e355..e9097d1 100644 --- a/include/so_long.h +++ b/include/so_long.h @@ -6,16 +6,28 @@ /* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/08 14:14:02 by dkaiser #+# #+# */ -/* Updated: 2024/05/10 12:24:12 by dkaiser ### ########.fr */ +/* Updated: 2024/05/11 16:10:26 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef SO_LONG_H # define SO_LONG_H -# define PLAYER_MOVE_SPEED 250 # include "MLX42/MLX42.h" +# include "fcntl.h" # include "libft.h" +# include "unistd.h" + +# define PLAYER_MOVE_SPEED 250 + +enum e_tile +{ + EMPTY = '0', + WALL = '1', + COLLECTIBLE = 'C', + EXIT = 'E', + PLAYER_START = 'P' +}; enum e_direction { @@ -32,6 +44,12 @@ typedef struct s_vector double y; } t_vector; +typedef struct s_ivector +{ + int x; + int y; +} t_ivector; + typedef struct s_player { t_vector position; @@ -40,17 +58,30 @@ typedef struct s_player mlx_image_t *img; } t_player; +typedef struct s_tilemap +{ + t_ivector grid_size; + t_ivector tile_size; + char *tiles; + t_ivector player_start_tile; + t_ivector exit_tile; +} t_tilemap; + typedef struct s_game { mlx_t *mlx; void *window; t_player player; int input_direction; + t_tilemap map; } t_game; +int load_map_from_file(t_tilemap *tilemap, char *filename); + int init(t_game *game); -void loop(void *game); +void loop(void *params); int draw(t_game *game); +int draw_map(t_game *game); void on_key_input(mlx_key_data_t event, void *params); #endif // SO_LONG_H |
