aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-04-13 14:53:35 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-04-13 14:53:35 +0300
commita68f59b62a7a19a079806880004901214ca784f4 (patch)
tree2402814696965167e50e934592ae8d35dbcf6639 /path.c
parent9284218d664c22b3e512abacd2c70d15cc339307 (diff)
downloadastar-a68f59b62a7a19a079806880004901214ca784f4.tar.xz
More keybindings in anim()
Diffstat (limited to 'path.c')
-rw-r--r--path.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/path.c b/path.c
index c305d1a..e216d8a 100644
--- a/path.c
+++ b/path.c
@@ -21,10 +21,36 @@ int anim(Map map, size_t width, size_t height, Position start, Position end, Pos
message(height, "cur: %zu %zu", cur->x, cur->y);
if (automatic) { wrefresh(stdscr); usleep(ANIM_DELAY_USEC); return 0; }
switch (getch()) {
- 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 '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 'H': clear(); map_offset_x += 20; break;
+ case 'L': clear(); map_offset_x -= 20; break;
+ case 'J': clear(); map_offset_y -= 10; break;
+ case 'K': clear(); map_offset_y += 10; 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 'g':
+ switch (getch()) {
+ case 's':
+ clear();
+ map_offset_x = -start.x * 2 + COLS/2;
+ map_offset_y = -start.y + LINES/2;
+ break;
+ case 'e':
+ clear();
+ map_offset_x = -end.x * 2 + COLS/2;
+ map_offset_y = -end.y + LINES/2;
+ break;
+ }
+ break;
+
+ /* TODO: Add a binding to do a bmp */
+
case 'a': automatic = 1; break;
case 'q': return -1;
default: return 0;