James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Revision:
38:a85bc227b907
Parent:
37:de1f584bce71
--- a/Pause/Pause.h	Mon May 06 21:44:49 2019 +0000
+++ b/Pause/Pause.h	Thu May 09 01:09:18 2019 +0000
@@ -26,6 +26,52 @@
     PauseOption next_state[3];  /**<Array of enums for possible next option*/
     };
 
+/** Pause Class
+@brief Library to power the pause menu
+@brief Can pass frame values to control the flow of the game modes they're
+@brief utilised in, enabling features like restarting and quitting
+
+@author James Cummins
+
+@code
+
+#include "mbed.h"
+#include "Pause.h"
+
+Pause pause;        //create a pause object for the pause menu
+Gamepad gamepad;
+N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
+
+int main(){
+    //first initialise the pause menu so it points to top item first
+    pause.init();
+    int game_length = 90;   //desired game mode length in seconds
+    int fps = 30;           //frames per sec of the game mode
+    
+    //use either one or the other of these (for the correct game mode)
+    //to display instructions before the game commences
+    pause.brickbreaker_help(gamepad, lcd);
+    pause.classic_help(gamepad, lcd);
+    
+    for(int i = 0; i < game_length*fps; i++){
+        //
+        //
+        //code to operate a time based game mode
+        //
+        //
+        
+        if(gamepad.check_event(gamepad.BACK_PRESSED)){
+        //retrieve the user's choice from the pause menu
+            PauseOption choice = pause.pause_menu(gamepad, lcd, fps);
+        //jump to the appropriate point in the game mode
+            i = pause.brickbreaker_action(choice, gamepad, lcd, i, fps);
+        }
+    }
+}
+
+@endcode
+*/
+
 class Pause {
 
 public: