summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosias <me@josias.dev>2022-03-18 09:45:05 -0700
committerJosias <me@josias.dev>2022-03-18 09:45:05 -0700
commit16936fd57d1acc2063ad745b4ef926d462f9866f (patch)
treef5af28c91072dee6d6b72623429b7b33551641c1
parentb09ee0ecdaa36da9c9094f36aed278d1b8dfc098 (diff)
Allow arrow keysHEADmaster
-rw-r--r--blockbreak.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/blockbreak.c b/blockbreak.c
index b397041..c5cb0c2 100644
--- a/blockbreak.c
+++ b/blockbreak.c
@@ -107,6 +107,8 @@ int main()
}
int blocks_left = BLOCKS;
+ keypad(stdscr, TRUE);
+
/* Main physics loop */
while (1) {
if (kbhit()) {
@@ -115,12 +117,14 @@ int main()
endwin();
return 0;
case 'a':
+ case KEY_LEFT:
if ((paddle_x - PADDLE_SPEED) > 0)
paddle_x -= PADDLE_SPEED;
else
paddle_x = PADDLE_SIZE;
break;
case 'd':
+ case KEY_RIGHT:
if ((paddle_x + PADDLE_SPEED) < max_x)
paddle_x += PADDLE_SPEED;
else