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

Revision:
14:46a353b2a8e8
Parent:
4:673eb9735d44
Child:
15:d8ea0c7b7e64
--- a/HighScoreEntry.cpp	Tue Jun 11 19:29:04 2013 +0000
+++ b/HighScoreEntry.cpp	Tue Jun 11 21:04:48 2013 +0000
@@ -141,8 +141,46 @@
   }
   // Draw border around screen.
   CharFrame::Draw( gd, 0, 0, VISIBLE_CHAR_WIDTH, VISIBLE_CHAR_HEIGHT );
-  // Draw logo.
-  GDExtra::WriteProgCharBlock( gd, 2, 2, CharBlocks::EnterNameInstructionText );
+  // Draw instructions.
+  gd->putstr( 2, 2,  "   CONGRATULATIONS : YOU HAVE A HIGH SCORE!" );
+  gd->putstr( 2, 4,  "PLEASE ENTER YOUR NAME USING THE LEFT JOYSTICK" );
+  gd->putstr( 2, 6,  " TO MOVE THE CURSOR. PRESS THE LEFT BUTTON TO" );
+  gd->putstr( 2, 8,  "  ENTER EACH LETTER. MOVE CURSOR TO FOOT OF" );
+  gd->putstr( 2, 10, " SCREEN AND PRESS LEFT BUTTON WHEN FINISHED." );
+  // Draw character grid.
+  DrawGrid( gd );
+}
+
+// Grid constants.
+#define GRIDX 5
+#define GRIDY 14
+#define GRIDCOLUMNS 20
+#define GRIDROWS 3
+#define GRIDCOLUMNSPACING 2
+#define GRIDROWSPACING 2
+
+/***************************/
+/* DRAW THE CHARACTER GRID */
+/***************************/
+// Pass pointer to Gameduino to draw on in gd.
+void HighScoreEntry::DrawGrid( Gameduino *gd ) {
+    UInt8 code = PlayerName::MinChar;
+    UInt8 x = GRIDX, y = GRIDY;
+    UInt8 columnNumber = 0;
+    char str [] = "X";
+    while( code <= PlayerName::MaxChar ) {
+        str[ 0 ] = (char)code++;
+        gd->putstr( x, y, str );
+        columnNumber++;
+        if( columnNumber >= GRIDCOLUMNS ) {
+            columnNumber = 0;
+            x = GRIDX;
+            y += GRIDROWSPACING;
+        }
+        else {
+            x += GRIDCOLUMNSPACING;
+        }
+    }
 }
 
 /********************************/