Adam Baker 201166301

Dependencies:   mbed Gamepad N5110

Revision:
40:f53c70793975
Parent:
38:51ed5820ffe5
Child:
41:4b20f909bbcb
diff -r 500da3d26267 -r f53c70793975 main.cpp
--- a/main.cpp	Tue May 07 16:23:00 2019 +0000
+++ b/main.cpp	Tue May 07 18:07:39 2019 +0000
@@ -26,7 +26,6 @@
 void menu_quit(N5110 &lcd, Gamepad &pad);
 
 void select_continue_menu_item(N5110 &lcd, Gamepad &pad, int input);
-void print_continue_menu(N5110 &lcd); //
 void menu_continue(N5110 &lcd, Gamepad &pad);
 
 
@@ -98,19 +97,19 @@
 {
     int input = 0;
     do {
-        
+
         if (timer_flag == true) {                       //only run when timer flag is true (6fps)
 
-            timer_flag = 0; 
-                                                        //ADD TRICKR AND ANIMATION
-        input = menu.select_input(pad, lcd); 
-        
+            timer_flag = 0;
+
+            input = menu.select_input_main(pad, lcd);
+
         } else {
-            
-        sleep();
-        
-        }       //prints menu and toggles cursor depending on input,
-    } while (input == 0);                           //repeats untill an input is chosen
+
+            sleep();
+
+        }       
+    } while (input == 0);                               //repeats untill an input is chosen
 
     return input;
 }
@@ -169,15 +168,7 @@
 
             int highscore = blockhead.highscore();
 
-            lcd.clear();
-
-            lcd.printString("  Highscore.. ", 0,1);
-
-            char buffer[14];
-            sprintf(buffer,"%i", highscore);
-            lcd.printString(buffer,35,5);
-
-            lcd.refresh();
+            menu.print_highscore(lcd, highscore);
 
             if (pad.check_event(Gamepad::B_PRESSED)) {
                 goback = 1;
@@ -197,6 +188,7 @@
 {
 
     int goback = 0;
+    float contrast;
 
     do {
 
@@ -204,12 +196,9 @@
 
             timer_flag = 0;
 
-            lcd.clear();
-
-            lcd.printString("  settings ", 0,1);
-
-            lcd.refresh();
-
+            contrast = menu.print_settings(pad, lcd);
+            lcd.setContrast(contrast);
+            
             if (pad.check_event(Gamepad::B_PRESSED)) {
                 goback = 1;
             }
@@ -246,35 +235,22 @@
     }
 }
 
-void print_menu_continue(N5110 &lcd)
-{
-    lcd.clear();
-
-    lcd.printString("Continue??",0,0);
-    lcd.printString("A for hell yeh",0,1);
-    lcd.printString("B for back",0,2);
-    lcd.refresh();
-
-}
-
 void menu_continue(N5110 &lcd, Gamepad &pad)
 {
     blockhead.continueInit();
-
-    print_menu_continue(lcd);
+    menu.init();
 
     int input = 0;
     do {
 
-        if (pad.check_event(Gamepad::A_PRESSED)) {
-            input = 1;
-        }
+        if (timer_flag == true) {
+
+            timer_flag = 0;
 
-        if (pad.check_event(Gamepad::B_PRESSED)) {
-            input = 2;
+            input = menu.select_input_continue(pad, lcd);
+
         }
-
-    } while (input ==0);
+    } while (input == 0);
     select_continue_menu_item(lcd, pad, input);
 }