ELEC2645 (2018/19) / Mbed 2 deprecated el17ttds

Dependencies:   mbed N5110_tf

Revision:
2:ee9b361ba6df
Parent:
1:8e319bd14b84
Child:
3:3d35ab70b565
--- a/main.cpp	Sun May 05 14:21:56 2019 +0000
+++ b/main.cpp	Sun May 05 21:54:07 2019 +0000
@@ -3,6 +3,7 @@
 /////////////// objects ///////////////
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
 Gamepad pad;
+Engine engine;
 
 int main() {
     
@@ -11,15 +12,18 @@
     string option = menu();
     begin(option);
     
+    lcd.printString("     END",0,3);
 }
 
 void init() {
     
+    
     // initialise display and peripherals
     lcd.init();
     pad.init();
     
     // initialise any in game functions (e.g: sprites)
+    engine.init(MAP_WIDTH,MAP_HEIGHT);
 }
 
 void welcome() {
@@ -126,11 +130,19 @@
 }
 
 void play() {
-    lcd.printString(" Playing!! ",0,0);
-    lcd.refresh();
+
+    wait(0.2);
+    
+    while (pad.check_event(Gamepad::START_PRESSED) == false) {
+        engine.read(pad);
+        engine.write(MAX_SPEED);
+        engine.render(lcd);
+        wait(0.1);
+    }
 }
 
 void tutorial() {
+    
     lcd.printString(" Tutorial!! ",0,0);
     lcd.refresh();
 }