ELEC2645 (2018/19) / Mbed 2 deprecated el17arm

Dependencies:   mbed

Revision:
63:ec95e155fb30
Parent:
60:3df033345059
Child:
64:b373b6bf8255
diff -r 7574a7bbdf98 -r ec95e155fb30 main.cpp
--- a/main.cpp	Wed May 08 11:57:37 2019 +0000
+++ b/main.cpp	Thu May 09 11:04:28 2019 +0000
@@ -10,11 +10,19 @@
 
 ///////// pre-processor directives ////////
 
+
 #include "mbed.h"
 #include "N5110.h"
 #include "Gamepad.h"
 #include "Gameengine.h"
 
+#define WITH_TESTING
+
+#ifdef WITH_TESTING
+#include "tests.h"
+#endif
+
+
 /////////////// objects ///////////////
 
 Gameengine game;
@@ -63,7 +71,11 @@
 ///////////// functions ////////////////
 
 int main()
-{
+{   
+    #ifdef WITH_TESTING
+    run_tests(lcd);
+    #endif
+    
     init();     // initialises screen and default game settings
     start_screen();     // waits for user to press start to begin
     option_screen(); // displays options screen
@@ -129,6 +141,25 @@
         }
     }
 }
+// displays options screen
+void option_screen()
+{
+    while (options == true) {
+        lcd.clear();
+        lcd.printString("Stick = L/R",0,0);
+        lcd.printString("A = Jump ",0,1);
+        lcd.printString("Get keys and",0,2);
+        lcd.printString("return to exit",0,3);
+        lcd.printString("Led=time/lives",0,4);
+        lcd.printString("<< Press back",0,5);
+        //printf("options screen = %d \n",options);
+        lcd.refresh();
+        if (pad.check_event(Gamepad::BACK_PRESSED) == true) {
+            options = false;
+            start_screen();
+        }
+    }
+}
 
 // displays appropriate screen with final score for game over and game complete
 void restart()
@@ -153,25 +184,6 @@
     }
 }
 
-void option_screen()
-{
-    while (options == true) {
-        lcd.clear();
-        lcd.printString("Stick = L/R",0,0);
-        lcd.printString("A = Jump ",0,1);
-        lcd.printString("Get keys and",0,2);
-        lcd.printString("return to exit",0,3);
-        lcd.printString("Led=time/lives",0,4);
-        lcd.printString("<< Press back",0,5);
-        //printf("options screen = %d \n",options);
-        lcd.refresh();
-        if (pad.check_event(Gamepad::BACK_PRESSED) == true) {
-            options = false;
-            start_screen();
-        }
-    }
-}
-
 // leds indicate how many lives and time left
 void leds()
 {