diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-14 15:05:03 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-14 15:05:03 +0300 |
| commit | 7fd2c1ca96f2972bc53a4a89cb6db582c4f6e2e1 (patch) | |
| tree | 17b935a1b7b38834d5cb9347c8a06ea30054a345 | |
| parent | c73a11860175a830c9b04967eac56dbd8221f311 (diff) | |
Rename player into start
| -rw-r--r-- | config.h | 4 | ||||
| -rw-r--r-- | main.c | 6 | ||||
| -rw-r--r-- | map.c | 10 | ||||
| -rw-r--r-- | map.h | 4 |
4 files changed, 12 insertions, 12 deletions
@@ -3,9 +3,9 @@ // The characters that represent different tiles #define EMPTY_CHAR '.' -#define GOAL_CHAR 'X' +#define GOAL_CHAR 'Z' #define WALL_CHAR '#' -#define PLAYER_CHAR '@' +#define START_CHAR 'A' #define DRAW_MAP_OFFSET_X 1 #define DRAW_MAP_OFFSET_Y 1 @@ -24,7 +24,7 @@ void initialize_colors(void) { init_pair(EMPTY_COLOR, COLOR_BLACK, -1); init_pair(GOAL_COLOR, COLOR_CYAN, -1); init_pair(WALL_COLOR, COLOR_WHITE, -1); - init_pair(PLAYER_COLOR, COLOR_RED, -1); + init_pair(START_COLOR, COLOR_RED, -1); } int main(void) { @@ -37,8 +37,8 @@ int main(void) { initialize_colors(); Map map = rbt_maze_map(20, 10, (unsigned int) time(NULL)); - Position fake_player_position_to_pass_into_draw_map = {11, 21}; - draw_map(map, 20*2-1, 10*2-1, fake_player_position_to_pass_into_draw_map); + Position fake_start_position_to_pass_into_draw_map = {11, 21}; + draw_map(map, 20*2-1, 10*2-1, fake_start_position_to_pass_into_draw_map); getch(); endwin(); @@ -94,7 +94,7 @@ Map rbt_maze_map(size_t width, size_t height, unsigned int seed) { return map; } -void draw_map(Map map, int width, int height, Position player_pos) { +void draw_map(Map map, int width, int height, Position start) { // Draw field char c; // The char for the current tile for (int i = 0; i < height; i++) { @@ -121,9 +121,9 @@ void draw_map(Map map, int width, int height, Position player_pos) { } } - // Draw the player - attron(COLOR_PAIR(PLAYER_COLOR)); - mvaddch(player_pos.y + DRAW_MAP_OFFSET_Y, player_pos.x + DRAW_MAP_OFFSET_X, PLAYER_CHAR); - attroff(COLOR_PAIR(PLAYER_COLOR)); + // Draw the start + attron(COLOR_PAIR(START_COLOR)); + mvaddch(start.y + DRAW_MAP_OFFSET_Y, start.x + DRAW_MAP_OFFSET_X, START_CHAR); + attroff(COLOR_PAIR(START_COLOR)); } @@ -16,7 +16,7 @@ enum Colors_e { EMPTY_COLOR = 1, GOAL_COLOR = 2, WALL_COLOR = 3, - PLAYER_COLOR = 4, + START_COLOR = 4, }; // A map is a 2D array of MapTiles. @@ -36,6 +36,6 @@ unsigned int neighbours(Position neighbour_array[], Position pos, size_t width, Map rbt_maze_map(size_t width, size_t height, unsigned int seed); // Draw the map. Bet you didn't expect that. -void draw_map(Map map, int width, int height, Position player_pos); +void draw_map(Map map, int width, int height, Position start); #endif //MAP_H_ |
