Show controls at start an pause.
authorGwyn Ciesla <limburgher@gmail.com>
Mon, 6 Aug 2012 21:44:50 +0000 (16:44 -0500)
committerGwyn Ciesla <limburgher@gmail.com>
Mon, 6 Aug 2012 21:44:50 +0000 (16:44 -0500)
NOTES
draw.cpp
draw.h
main.cpp

diff --git a/NOTES b/NOTES
index 4ebfa34..4f0fc92 100644 (file)
--- a/NOTES
+++ b/NOTES
@@ -1,4 +1,2 @@
 Upload scores?
 game over play again or quit dialogue.
-display controls for a few seconds, and at pause, with reference to man
-page.
\ No newline at end of file
index 8e527e6..165a17c 100644 (file)
--- a/draw.cpp
+++ b/draw.cpp
@@ -94,3 +94,13 @@ void draw_board(int score, int lives, int level, int shieldsleft, int missile){
   mvprintw(22,1,"Lvl:%3d", level);
   mvprintw(22,9,"S:%3d",  shieldsleft);
 }
+
+void display_controls(){
+  mvprintw(1,21,"Movement: Arrow keys");
+  mvprintw(1,46,"Shoot: Z");
+  mvprintw(2,46,"Shield toggle: S");
+  mvprintw(3,46,"Smart bomb: A");
+  mvprintw(2,21,"Pause: Space");
+  mvprintw(3,21,"Quit: Q");
+  mvprintw(5,18,"See \'man curblaster\' for complete documentation");
+};
diff --git a/draw.h b/draw.h
index a255857..045c441 100644 (file)
--- a/draw.h
+++ b/draw.h
@@ -1,2 +1,3 @@
 int draw_object(game_object, int);
 void draw_board(int, int, int, int, int);
+void display_controls();
index d04c4ed..bd41544 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -64,6 +64,7 @@ int missile = 0;
 int super_shield = 0;
 int sound = 1;
 
+
 int main(int argc, char *argv[]){
 
   //Initialize world
@@ -645,6 +646,7 @@ int main(int argc, char *argv[]){
   //hold until SPACE pressed
   pause_game = 0;
   int counter = 0;
+  int show_controls = 30;
   while(pause_game!=' '){
     //cbreak();
     pause_game = getch();
@@ -933,9 +935,15 @@ int main(int argc, char *argv[]){
       count--;
     };
 
+    if(show_controls>=1){
+      display_controls();
+      show_controls--;
+    };
+
     //get the cursor out of the way
     mvprintw(23,79,"|");
 
+
     input = getch();
     
     //quit
@@ -995,6 +1003,7 @@ int main(int argc, char *argv[]){
       pause_game = 0;
       while(pause_game!=' '){
        cbreak();
+       display_controls();
        mvprintw(10,25,"Paused.  Press SPACE to continue.\n");
        pause_game = getch();
        halfdelay(1);