summaryrefslogtreecommitdiff
path: root/sirtet.c
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-06-01 15:47:02 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-06-01 15:47:02 +0800
commit384f833e839cf8f5e71b656cf7b390fc80d89e9d (patch)
tree35a3bba6131018624cd2bd3d8c2c4d3eee106b11 /sirtet.c
parentd191870068f89293353a67b164b4dbb3b3a71661 (diff)
Help text, wasd/hjkl navigation
Diffstat (limited to 'sirtet.c')
-rw-r--r--sirtet.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sirtet.c b/sirtet.c
index 9e9d0b2..3dc76f3 100644
--- a/sirtet.c
+++ b/sirtet.c
@@ -95,6 +95,7 @@ void sirtet() {
clear();
printrect(0, 0, H, W);
printmap(map, 1, 1, H, W);
+ printhelp(3, 2 * W + 8);
// display game stats
mvprintw(1, 2 * W + 8, "Points: %d", points);
@@ -133,15 +134,23 @@ void sirtet() {
break;
// arrow keys: move piece on map
case KEY_LEFT:
+ case 'a':
+ case 'h':
if (col > 0) col--;
break;
case KEY_RIGHT:
+ case 'd':
+ case 'l':
if (col + pc->w < W) col++;
break;
case KEY_UP:
+ case 'w':
+ case 'k':
if (row > 0) row--;
break;
case KEY_DOWN:
+ case 's':
+ case 'j':
if (row + pc->h < H) row++;
break;
// [ and ]: switch pieces
@@ -165,6 +174,11 @@ void sirtet() {
}
}
break;
+ // q: quit
+ case 'q':
+ confirmed = true;
+ over = true;
+ break;
}
}
@@ -203,8 +217,8 @@ void sirtet() {
}
if (!has_placeable) {
// game over
- mvprintw(3, 2 * W + 8, "Game over");
- mvprintw(4, 2 * W + 8, "Press any key to exit");
+ mvprintw(7, 2 * W + 8, "Game over");
+ mvprintw(8, 2 * W + 8, "Press any key to exit");
refresh();
while (getch() == 0);
over = true;