diff options
author | June McEnroe <june@causal.agency> | 2021-01-29 16:00:37 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-01-29 16:00:37 -0500 |
commit | 0ea390f08b15a12d865816fa8efd402e7b0c0027 (patch) | |
tree | 6618459f877c5dd471a18fce3e109966484d8901 | |
parent | Add menu to choose 2048 or snake (diff) | |
download | play-0ea390f08b15a12d865816fa8efd402e7b0c0027.tar.gz play-0ea390f08b15a12d865816fa8efd402e7b0c0027.zip |
Add pause to snake
Diffstat (limited to '')
-rw-r--r-- | snake.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/snake.c b/snake.c index b67fe4d..e2d6e11 100644 --- a/snake.c +++ b/snake.c @@ -187,6 +187,13 @@ static void input(void) { break; case 'k': case KEY_UP: dy = -1; dx = 0; break; case 'l': case KEY_RIGHT: dy = 0; dx = +1; break; case 'q': over = "You are satisfied."; + break; case 'p': case ' ': { + nodelay(stdscr, false); + do { + ch = getch(); + } while (ch != ERR && ch != 'p' && ch != ' '); + nodelay(stdscr, true); + } break; case ERR: exit(EXIT_FAILURE); } if (dy == -head.dy && dx == -head.dx) return; |