James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Revision:
29:42651f87522b
Parent:
22:4e305ff8a050
Child:
36:9f7463a65fe0
--- a/Pause/Pause.cpp	Thu Apr 25 16:26:34 2019 +0000
+++ b/Pause/Pause.cpp	Sat Apr 27 12:50:30 2019 +0000
@@ -10,7 +10,7 @@
     _state = RESUME;
 }
 
-int Pause::pause_menu(Gamepad &gamepad, N5110 &lcd, int fps, int frame, Mode mode){
+PauseOption Pause::pause_menu(Gamepad &gamepad, N5110 &lcd, int fps){
     PauseOption choice = RESUME;
     while(!(gamepad.check_event(gamepad.A_PRESSED))){
         lcd.clear();
@@ -19,17 +19,21 @@
         lcd.refresh();
         wait(0.2);
     }
+    return choice;
+}
+
+
+
+int Pause::brickbreaker_action(PauseOption choice, Gamepad &gamepad, N5110 &lcd, int frame, int fps){    
     int jump_to_frame = frame;
     if(choice == RESUME){ jump_to_frame = frame; } //Just keep code iterating
     if(choice == RESTART){ jump_to_frame = 0; } //return to frame 1 if restarted
-    if(choice == QUIT){ jump_to_frame = 45*fps; } //jump to final frame
-    if(choice == HELP){  //display relevant help screen
-        if(mode == CLASSIC_MODE){ classic_help(gamepad, lcd); }
-        if(mode == BRICKBREAKER_MODE){ brickbreaker_help(gamepad, lcd); }
-    }
-    return jump_to_frame;
+    if(choice == QUIT){ jump_to_frame = 45*fps; }  //jump to final frame
+    if(choice == HELP){ brickbreaker_help(gamepad, lcd); }
+    return jump_to_frame;                       //display relevant help screen
 }
 
+
 void Pause::display_pause_options(N5110 &lcd){
     lcd.printString("GAME PAUSED:", 6, 0);
     lcd.printString("Resume", 24, 1);
@@ -55,6 +59,20 @@
     return _state;
 }
 
+void Pause::classic_help(Gamepad &gamepad, N5110 &lcd){
+    while(!(gamepad.check_event(gamepad.A_PRESSED))){
+        lcd.clear();
+        lcd.printString("Help", 30, 0);
+        lcd.printString("Don't leave", 0, 1);
+        lcd.printString("the path! Tilt", 0, 2);
+        lcd.printString("pad to roll", 0, 3);
+        lcd.printString("the ball", 0, 4);
+        lcd.printString("A = go back", 0, 5);
+        lcd.refresh();
+        wait(0.5);
+    }
+}
+
 void Pause::brickbreaker_help(Gamepad &gamepad, N5110 &lcd){
     while(!(gamepad.check_event(gamepad.A_PRESSED))){
         lcd.clear();
@@ -67,18 +85,4 @@
         lcd.refresh();
         wait(0.5);
     }
-}
-
-void Pause::classic_help(Gamepad &gamepad, N5110 &lcd){
-    while(!(gamepad.check_event(gamepad.A_PRESSED))){
-        lcd.clear();
-        lcd.printString("Help", 30, 0);
-        lcd.printString("Don't leave", 0, 1);
-        lcd.printString("the path! Tilt", 0, 2);
-        lcd.printString("pad to roll", 0, 3);
-        lcd.printString("the ball", 0, 4);
-        lcd.printString("A = go back", 0, 5);
-        lcd.refresh();
-        wait(0.5);
-    }
 }
\ No newline at end of file