Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.

Dependencies:   25LCxxx_SPI CommonTypes Gameduino mbed

Files at this revision

API Documentation at this revision

Comitter:
RichardE
Date:
Mon Jun 17 15:10:43 2013 +0000
Parent:
17:194789db2215
Commit message:
Improved response to button 1 when entering high scores (HighScoreEntry.cpp).

Changed in this revision

HighScoreEntry.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 194789db2215 -r 70190f956a24 HighScoreEntry.cpp
--- a/HighScoreEntry.cpp	Sun Jun 16 08:54:57 2013 +0000
+++ b/HighScoreEntry.cpp	Mon Jun 17 15:10:43 2013 +0000
@@ -153,7 +153,7 @@
     // Read panel controls.
     controls->Read();
     inputs = controls->GetInputs();
-    // Only react to controls every so often to slow things down.
+    // Only react to joystick controls every so often to slow things down.
     if( countdown == 0 ) {
       countdown = 10;
       bool cursorMoved = false;
@@ -190,25 +190,6 @@
             cursorMoved = true;
         }
       }
-      if( inputs & PanelControls::Button1 ) {
-          // Button 1 adds a character or possibly does something special.
-          if( cursorRow < grid.GetRowCount() - 1 ) {
-              char newChar = (char)( PlayerName::MinChar + cursorRow * GRIDCOLUMNS + cursorColumn );
-              name->Name[ charIndex ] = newChar;
-              if( charIndex < PlayerName::Length - 1 ) {
-                  charIndex++;
-              }
-          }
-          else {
-              // Last row contains special functions.
-              SpecialFunction( gd, cursorColumn, name, done );
-          }
-          // Draw modified name.
-          gd->waitvblank();
-          DrawName( gd, name );
-          // Wait until player releases all controls.
-          WaitControls( gd, controls, false );
-      }
       // If necessary redraw the cursor.
       if( cursorMoved ) {
           WipeCursor( gd, lastCell );
@@ -218,6 +199,26 @@
     else {
       countdown--;
     }
+    // Read button 1 on every loop to get instant response,
+    if( inputs & PanelControls::Button1 ) {
+        // Button 1 adds a character or possibly does something special.
+        if( cursorRow < grid.GetRowCount() - 1 ) {
+            char newChar = (char)( PlayerName::MinChar + cursorRow * GRIDCOLUMNS + cursorColumn );
+            name->Name[ charIndex ] = newChar;
+            if( charIndex < PlayerName::Length - 1 ) {
+                charIndex++;
+            }
+        }
+        else {
+            // Last row contains special functions.
+            SpecialFunction( gd, cursorColumn, name, done );
+        }
+        // Draw modified name.
+        gd->waitvblank();
+        DrawName( gd, name );
+        // Wait until player releases all controls.
+        WaitControls( gd, controls, false );
+    }
     // Wait for vertical flyback. Then do animation.
     gd->waitvblank();
     FrameCounter++;