ELEC2645 (2018/19) / Mbed 2 deprecated el17dtt

Dependencies:   mbed

Revision:
8:b3738229ba85
Parent:
7:9e9424f5ec4b
Child:
9:dc13042b09f5
--- a/main.cpp	Sat May 04 00:11:14 2019 +0000
+++ b/main.cpp	Sat May 04 22:46:31 2019 +0000
@@ -25,6 +25,7 @@
 /////////////// objects ///////////////
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
 Gamepad gamepad;
+Engine engine;
 
 ///////////// prototypes ///////////////
 void init();
@@ -34,24 +35,33 @@
 ///////////// functions ////////////////
 int main() {
     
+    int fps = 8;  // frames per second
+    
     init();
     
     welcome();
     
     // game loop - read input, update the game state and render the display
     while(1) {
+        // engine.read_input(gamepad);
+        engine.update(gamepad, lcd);
         render();
+        wait(1.0f/fps);
     }
 }
 
+
 // initialies all classes and libraries
 void init()
 {
 
-    // need to initialise LCD and Gamepad 
+    // need to initialise LCD and Gamepad and Engine
     lcd.init();
     gamepad.init();
-
+    
+    // init the engine and start the game at 0 speed
+    engine.init(48 , 84, 0);
+    
     gamepad.leds_on();
     lcd.setContrast(0.4);
 }
@@ -59,12 +69,15 @@
 void welcome() {
     
     Menu menu;   
-    menu.intro(lcd, gamepad);
-    menu.startMainMenu(lcd, gamepad);
+    //menu.intro(lcd, gamepad);
+    while (menu.startMainMenu(lcd, gamepad) == 1) {
+        //menu.displayControls(lcd, gamepad);
+    };
 }
 // this function draws each frame on the LCD
 void render() {
     
         lcd.clear();
+        //engine.draw(lcd);
         lcd.refresh();
 }
\ No newline at end of file