diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-10 18:59:23 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-10 18:59:23 +0300 |
| commit | fe40ce26ec975c2e2f89409913321064a7876d5c (patch) | |
| tree | 143eccd14ef8270cf102aaf658abfadbe5f532dd /map.h | |
Initial commit
Diffstat (limited to 'map.h')
| -rw-r--r-- | map.h | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -0,0 +1,37 @@ +#ifndef MAP_H_ +#define MAP_H_ + +#include <stddef.h> +#include "structs.h" + +enum MapTile_e { + EMPTY = 0, + GOAL, + WALL, +}; + +typedef enum MapTile_e MapTile; + +enum Colors_e { + EMPTY_COLOR = 1, + GOAL_COLOR = 2, + WALL_COLOR = 3, + PLAYER_COLOR = 4, +}; + +// A map is a 2D array of MapTiles. +// Use as map[row][column] +typedef MapTile** Map; + +// Returns an empty map of given size +Map empty_map(size_t width, size_t height); + +// https://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_depth-first_search +// WARNING: width and height are not the width and height of the returned map! +// TODO: formula for actual size +Map rbt_maze_map(size_t width, size_t height); + +// Draw the map. Bet you didn't expect that. +void draw_map(Map map, int width, int height, Position player_pos); + +#endif //MAP_H_ |
