aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-04-03 17:31:27 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-04-03 17:31:27 +0300
commit0dd0adf9547758381573caa6a7d485415fafb33d (patch)
tree06ed17c351d7adc6920d8bed6f3bdf87b8d958bd /main.c
parent97decbee0dbc066db7ee94d0988ee26c1f8b35a8 (diff)
downloadastar-0dd0adf9547758381573caa6a7d485415fafb33d.tar.xz
Make map offsets global
Diffstat (limited to 'main.c')
-rw-r--r--main.c17
1 files changed, 6 insertions, 11 deletions
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':