Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
68:b9cfd27987ac
Parent:
67:39b9ba6019b0
Child:
69:55e309da7efd
--- a/main.cpp	Sat May 04 12:28:04 2019 +0000
+++ b/main.cpp	Sat May 04 16:56:04 2019 +0000
@@ -17,6 +17,10 @@
 #include "SnakevsBlock.h"
 #include "SDFileSystem.h"
 
+#ifdef WITH_TESTING
+# include "tests.h"
+#endif
+
 /////////////// objects ///////////////
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
 Gamepad pad;
@@ -34,6 +38,7 @@
 void refresh_game();
 void read_write_stats();
 void _set_mode_speed();
+//void deinit();
 
 //Constants//
 int fps = 40;  // frames per second, this will be changed in menu.
@@ -43,6 +48,12 @@
 ///////////// MAIN ////////////////
 int main()
 {
+#ifdef WITH_TESTING
+    int number_of_failures = run_all_tests();
+
+    if(number_of_failures > 0) return number_of_failures;
+#endif
+
     init();
     _start.titleScreen(lcd, pad);
     while(1)  { //This loop is created for Play/Continue configuration
@@ -60,7 +71,7 @@
             _game.read_input(pad, device, g_mode); //this reads the angle or joystick direction, on the condition of either of them being selected.
             _game.update(lcd, pad); //updates the game screen and checks for any collisions.
             refresh_game();
-            
+
             //the int back stores the value 1 if back is pressed inside the update function of snakevsblock,
             //This function also handles level progression and level failure operations by using the class WinLoose.
             back = _game.CheckGameProgression(lcd, pad, sd); //and also sends relevant data to the sd card to implement stats functionality.
@@ -103,8 +114,18 @@
 {
     fps = _start.fps; // sets the frames per second required, selected from the game speed menu.
     g_mode = _start.g_mode;// allows us to pass this information on to the snakevsblock class, to set the controls to either joystick or motion control.
-    
+
     if (g_mode == 2) {  //show instructions to handle motion control.
         _start.motionControlInstructions(lcd);    //this only comes up on the screen is the user selects motion control from menu options.
     }
-}
\ No newline at end of file
+}
+/*
+void deinit()
+{
+    // need to deinitialise to quit.
+    lcd.~N5110(); //deinit for the N5110 Library.
+    pad.~Gamepad(); //deinit for the Gamepad Library.
+    device.~FXOS8700CQ(); //deinit for the FXOS8700CQ Library.
+
+}
+*/
\ No newline at end of file