Su 200943147

Dependencies:   Gamepad N5110 mbed

Revision:
6:e919a1fd1eed
Parent:
5:afa6592a4ba5
Child:
7:31dd8865cc44
--- a/main.cpp	Sat Apr 29 14:33:25 2017 +0000
+++ b/main.cpp	Wed May 03 08:42:22 2017 +0000
@@ -12,17 +12,20 @@
 Gamepad pad;
 Engine Engine;
 void Init();
+void Welcome();
 
 int main()
 {
     Init();
+    //Welcome();
     // game loop - read input, update the game state and render the display
     while (1) {
         Engine.ReadInput(pad);
         Engine.Update(pad);
         Engine.Pixel(lcd);
         lcd.refresh();
-        wait(0.1);
+        lcd.clear();
+        wait(0.3);
     }
 }
 
@@ -37,3 +40,18 @@
     lcd.normalMode();      // normal colour mode
     lcd.setBrightness(0.5); // put LED backlight on 50%
 }
+
+void Welcome() {
+    
+    lcd.printString("   Tetris!    ",0,1);  
+    lcd.printString("  Press Start ",0,4);
+    lcd.refresh();
+     
+    // flashing LEDs until start button is pressed 
+    while ( pad.check_event(Gamepad::START_PRESSED) == false) {
+        pad.leds_on();
+        wait(0.1);
+        pad.leds_off();
+        wait(0.1);
+    }
+}
\ No newline at end of file