From 9a4c09683a385bf1ae2e9b67b674640f70fc73e0 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Mon, 13 Apr 2026 11:48:05 +0300 Subject: Add keybindings to move to top left and bottom right corners --- main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 91770a7..2178d2e 100644 --- a/main.c +++ b/main.c @@ -145,13 +145,17 @@ int main(int argc, char **argv) { while (1) { draw_map(map, width, height, start_pos, end_pos, NULL, path, visited, NULL); - char c = getch(); + int c = getch(); /* TODO: add a keybinding to calculate the path again, or maybe do it on 'a' */ + /* TODO: maybe a kbng to move to start/end? */ + /* TODO: big HJKL to move fasta */ switch (c) { 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 'z': clear(); map_offset_x = 2; map_offset_y = 1; break; /* Move to top left corner */ + case 'x': clear(); map_offset_x = - width * 2 + COLS - 2; map_offset_y = - height + LINES - 2; break; /* Move to bottom right corner */ case 'a': anim = !anim; break; case 'y': case 'o': @@ -211,6 +215,7 @@ int main(int argc, char **argv) { visited = visited_new(width, height); path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); break; + case KEY_RESIZE: clear(); break; case 'q': map_free(map, height); path_free(path, height); endwin(); return 0; } } -- cgit v1.2.3