summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-29 14:08:16 -0500
committerJune McEnroe <june@causal.agency>2021-01-29 14:08:16 -0500
commit46e2bea5d8bd74b30fbf4ba84ef04732b79b8628 (patch)
tree774623d7106db137b49e60d95d94e1bfad2d117d
parentGive the snake a tail (diff)
downloadplay-46e2bea5d8bd74b30fbf4ba84ef04732b79b8628.tar.gz
play-46e2bea5d8bd74b30fbf4ba84ef04732b79b8628.zip
Actually wait for a non-direction key
-rw-r--r--snake.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/snake.c b/snake.c
index 62f660f..1437deb 100644
--- a/snake.c
+++ b/snake.c
@@ -205,7 +205,12 @@ uint playSnake(void) {
 	draw();
 	while (ERR != getch());
 	nodelay(stdscr, false);
-	getch();
+	int ch;
+	do {
+		ch = getch();
+	} while (
+		ch == KEY_LEFT || ch == KEY_DOWN || ch == KEY_UP || ch == KEY_RIGHT
+	);
 	return score;
 }