]> git.armaanb.net Git - pong.git/blobdiff - pong.c
Add keybindings to manpage
[pong.git] / pong.c
diff --git a/pong.c b/pong.c
index 4bda2a7f21bbeae2bfcc795b6409a2986044b149..58a93d562ef15882ae4c4969d72d639eae3a2d70 100644 (file)
--- a/pong.c
+++ b/pong.c
@@ -78,13 +78,24 @@ main(void) {
                if (key == 'q') {
                        die(0);
                } else if (key == 'k') {
-                       boff += 2;
+                       if (boff < max_y - pad_h) boff += 1;
                } else if (key == 'i') {
-                       boff -= 2;
+                       if (boff > 0) boff -= 1;
                } else if (key == 's') {
-                       aoff += 2;
+                       if (aoff < max_y - pad_h) aoff += 1;
                } else if (key == 'w') {
-                       aoff -= 2;
+                       if (aoff > 0) aoff -= 1;
+               } else if (key == 27) {
+                       while(1) {
+                               key = getch();
+                               mvprintw(0, 0, "PAUSED");
+                               if (key == 27) {
+                                       clear();
+                                       break;
+                               } else if (key == 'q') {
+                                       die(0);
+                               }
+                       }
                }
 
                // Clear screen