aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-16 19:16:40 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-16 19:16:40 +0300
commitb1337798203e1ea4ddb7c76e6ca343e904fb19aa (patch)
tree10b9149656b7203551dc6d7af2b7c492327c3f73
parent9dd9d57af09addf20638356521f0e02c5fe96a16 (diff)
Make the maze adapt to screen size (not sure why)
-rw-r--r--main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main.c b/main.c
index 81eae31..5734db8 100644
--- a/main.c
+++ b/main.c
@@ -5,6 +5,7 @@
#include <time.h>
#include "map.h"
#include "structs.h"
+#include "config.h"
/* So, TODO for now:
- Implement Dijkstra and greedy-best-first search algorithms
@@ -38,10 +39,13 @@ int main(void) {
noecho(); /* Don't echo characters */
initialize_colors();
- Map map = rbt_maze_map(20, 10, (unsigned int) time(NULL));
+ /* FIXME: shitty. sometimes leaves enough space on the right for a bigger map */
+ size_t height = LINES/2 - DRAW_MAP_OFFSET_Y,
+ width = COLS/4 - 1;
+ Map map = rbt_maze_map(width, height, (unsigned int) time(NULL));
Position fake_start_position_to_pass_into_draw_map = {0, 0};
- Position fake_goal_position_to_pass_into_draw_map = {20*2-2, 10*2-2};
- draw_map(map, 20*2-1, 10*2-1, fake_start_position_to_pass_into_draw_map, fake_goal_position_to_pass_into_draw_map);
+ Position fake_goal_position_to_pass_into_draw_map = {width*2-2, height*2-2};
+ draw_map(map, width*2-1, height*2-1, fake_start_position_to_pass_into_draw_map, fake_goal_position_to_pass_into_draw_map);
getch();
endwin();