submit

Dependencies:   mbed Gamepad N5110

Revision:
3:1358cbb05ad3
Parent:
2:934daa65f73d
Child:
4:323f42022d87
--- a/main.cpp	Sat Apr 13 15:45:03 2019 +0000
+++ b/main.cpp	Sun Apr 14 05:45:31 2019 +0000
@@ -14,7 +14,6 @@
 ///////////// prototypes ///////////////
 void init();
 void run();
-void welcome();
 
 ///////////// functions ////////////////
 int main()
@@ -22,33 +21,19 @@
     int fps = 8;  // frames per second
     
     init(); 
-    welcome();  // show welcome display, waiting for the user to start
+    engine.welcome(pad,lcd);  // show welcome display, waiting for the user to start
     
      // game loop - read input, update the game state and render the display
     while (snake.over == 0) {
     run();
     wait(1.0f/fps);  // and wait for one frame period
     }
+    engine.gameover(pad,lcd);
 
  
 }
 
-// simple splash screen displayed on start-up
-void welcome() {
-    
-    lcd.printString(" ###SNAKE### ",0,1);  
-    lcd.printString("  Press Start ",0,4);
-    lcd.refresh();
-     
-    // wait 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);
-    }
- 
-}
+
 
 // this function draws each frame on the LCD
 void run()