From 0dd0adf9547758381573caa6a7d485415fafb33d Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Fri, 3 Apr 2026 17:31:27 +0300 Subject: Make map offsets global --- main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 88059f5..33b3af7 100644 --- a/main.c +++ b/main.c @@ -132,11 +132,6 @@ int main(int argc, char **argv) { init_ncurses(); } - int offset_x = 0, offset_y = 0; - - //draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, NULL, NULL, NULL, NULL); - //print_map_out(map, width, height); - char **visited = visited_new(width, height); Path path = NULL; path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); @@ -148,13 +143,13 @@ int main(int argc, char **argv) { } while (1) { - draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, NULL, path, visited, NULL); + draw_map(map, width, height, start_pos, end_pos, NULL, path, visited, NULL); char c = getch(); switch (c) { - case 'h': offset_x += 2; break; - case 'l': offset_x -= 2; break; - case 'j': offset_y -= 1; break; - case 'k': offset_y += 1; break; + case 'h': map_offset_x += 2; break; + case 'l': map_offset_x -= 2; break; + case 'j': map_offset_y -= 1; break; + case 'k': map_offset_y += 1; break; case 'a': anim = !anim; break; case 'y': case 'o': @@ -184,7 +179,7 @@ int main(int argc, char **argv) { case 's': /* TODO: prompt for filename? or do a define idk */ map_to_bmp(map, width, height, start_pos, end_pos, path, visited, "out.bmp"); - mvprintw(height + offset_y + DRAW_MAP_OFFSET_Y + 1, offset_x, "Saved to out.bmp"); + mvprintw(height + map_offset_y + DRAW_MAP_OFFSET_Y + 1, map_offset_x, "Saved to out.bmp"); getch(); break; case 'n': -- cgit v1.2.3