From fe40ce26ec975c2e2f89409913321064a7876d5c Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Tue, 10 Mar 2026 18:59:23 +0300 Subject: Initial commit --- main.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c new file mode 100644 index 0000000..ee317c4 --- /dev/null +++ b/main.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include "map.h" +#include "structs.h" + +void sigint_handler(int sig) { + (void)sig; // We know it's a SIGINT + endwin(); + printf("Received SIGINT\n"); + exit(1); +} + +void initialize_colors(void) { + start_color(); + use_default_colors(); + 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); +} + +int main(void) { + signal(SIGINT, sigint_handler); + + initscr(); // Initialize the ncurses screen + cbreak(); // Process input one char at a time + curs_set(0); // Hide the cursor + noecho(); // Don't echo characters + initialize_colors(); + + Map map = rbt_maze_map(20, 10); + Position fake_player_position_to_pass_into_draw_map = {0, 0}; + draw_map(map, 20*2-1, 10*2-1, fake_player_position_to_pass_into_draw_map); + getch(); + + endwin(); + return 0; +} -- cgit v1.2.3