Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Revision:
10:da5743dfb137
Parent:
9:f720f5d87420
Child:
12:b3ec47d606a5
--- a/main.cpp	Wed May 08 23:09:43 2019 +0000
+++ b/main.cpp	Thu May 09 10:53:00 2019 +0000
@@ -28,6 +28,11 @@
 #include "Ball.h"
 #include "Map.h"
 
+#define WITH_TESTING
+#ifdef WITH_TESTING
+#include "tests.h"
+#endif
+
 const int fps = 20; /** Sets the fps of the game, doesn't change */
 
 /////////////// objects ///////////////
@@ -46,7 +51,12 @@
 
 ///////////// functions ////////////////
 int main() 
-{   
+{
+#ifdef WITH_TESTING
+int number_of_failures = run_tests();
+if(number_of_failures > 0) return number_of_failures;  
+#endif
+ 
     init();     /** Initialize LCD and Gamepad */ 
     welcome();  /** Waiting for the user to start */ 
     render();   /** Game Loop */ 
@@ -152,12 +162,12 @@
                 sprintf(finalscore,"Score = %d",map.score);
                 lcd.printString(finalscore,0,0);
                 lcd.printString("You WON!",17,2);
-                lcd.printString("Press A",20,3);
+                lcd.printString("Press B",20,3);
                 lcd.printString("to restart",12,4);
                 wait(0.1);
                 lcd.refresh();
                 /** Checks if reset button is pressed, if it is reset */
-                if (pad.check_event(Gamepad::A_PRESSED) == true)
+                if (pad.check_event(Gamepad::B_PRESSED) == true)
                 {
                     resetGame();
                     break;