Ikenna Adrian Ozoemena 201157039

Dependencies:   mbed

Revision:
53:3fdc4486f672
Parent:
52:29772e31a620
--- a/main.cpp	Thu May 09 13:22:45 2019 +0000
+++ b/main.cpp	Thu May 09 14:52:52 2019 +0000
@@ -10,30 +10,26 @@
 
 #include "main.h"
 /** @file main.cpp
- *  @brief This file is designated to start the program by calling all the necessary functions in a sequential manner.
+ *  @brief Main file used to run the game using the game engine RosenEngine
  */
 
 
 //_______________functions______________________________________________________
 int main()
 {
-    #ifdef WITH_TESTING
+    // adds testing to the main file if it is declared in macros
+#ifdef WITH_TESTING
     int number_of_failures = run_all_tests();
 
     if(number_of_failures > 0) return number_of_failures;
-    #endif
-    
+#endif
+
+    // initialize game objects and engine
     init();
-    printf("Init function completed...\n");
-
     while(1) {
         welcome();
-        printf("welcome()\n");
         rosen.reset();
-        printf("reset()\n");
-        //printf("ycursor = %d",rosen.get_ycursor());
         if(rosen.get_ycursor() == 16) {
-            //  printf("get_ycursor() == 16()\n");
             while ( pad.check_event(Gamepad::BACK_PRESSED) == false && rosen.dead() == false) {
                 rosen.read_input(pad);
                 rosen.update(pad);
@@ -48,7 +44,14 @@
                 rosen.update(pad);
                 ship_select();
                 wait(1.0f/fps);
-                // printf("menu...\n");
+            }
+        }
+        if(rosen.get_ycursor() == 32) {
+            while ( pad.check_event(Gamepad::BACK_PRESSED) == false) {
+                rosen.read_input(pad);
+                rosen.update(pad);
+                display_help();
+                wait(1.0f/fps);
             }
         }
     }
@@ -78,10 +81,17 @@
     rosen.ship_select(lcd);
     rosen.get_pos();
     lcd.refresh();
-    printf("Ship Select...\n");
+    // printf("Ship Select...\n");
+}
+void display_help()
+{
+    lcd.clear();
+    rosen.get_pos();
+    rosen.help(lcd);
+    lcd.refresh();
+    // printf("Ship Select...\n");
 }
 
-// simple splash screen displayed on start-up
 void welcome()
 {
     while( pad.check_event(Gamepad::START_PRESSED) == false) {
@@ -90,5 +100,5 @@
         rosen.read_input(pad);
         lcd.refresh();
     }
-    printf("Welcome Function completed...\n");
+    // printf("Welcome Function completed...\n");
 }
\ No newline at end of file