Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Pause/Pause.h
- Revision:
- 37:de1f584bce71
- Parent:
- 29:42651f87522b
- Child:
- 38:a85bc227b907
diff -r 9f7463a65fe0 -r de1f584bce71 Pause/Pause.h --- a/Pause/Pause.h Mon May 06 00:05:52 2019 +0000 +++ b/Pause/Pause.h Mon May 06 21:44:49 2019 +0000 @@ -6,11 +6,13 @@ #include "ClassicEngine.h" #include "N5110.h" +/** Enum for game mode*/ enum Mode{ - CLASSIC_MODE, + CLASSIC_MODE, BRICKBREAKER_MODE }; - + +/** Enum for Pause Options*/ enum PauseOption{ RESUME, RESTART, @@ -18,24 +20,56 @@ HELP }; +/**Pause selection struct*/ struct PauseSelection{ - int output; - PauseOption next_state[3]; + int output; /**<Integer output for line to print arrows*/ + PauseOption next_state[3]; /**<Array of enums for possible next option*/ }; class Pause { public: - //constructor + /** + * @brief Create a Pause object + */ Pause(); - //destructor + /** + * @brief Delete Pause object to free memory + */ ~Pause(); - //initialiser + /** + * @brief Initialise the pause menu with the first menu option highlighted + */ void init(); - //accessor + /** + * @brief Read the user input and update the displayed menu until an option is selected + * @param gamepad - Gamepad object to sense user interaction + * @param lcd - N5110 object to render menu on LCD screen + * @param fps - integer value of frames per second game is ran at + * @returns an Enum of the pause option selected by user (RESUME, RESTART, QUIT or HELP) + */ PauseOption pause_menu(Gamepad &gamepad, N5110 &lcd, int fps); + /** + * @brief Jump to a specified frame in the game based on user's menu choice + * @param choice - option selected in the Pause menu + * @param gamepad - Gamepad object to check for button press + * @param lcd - N5110 object to interact with LCD screen + * @param frame - integer of current no. of frames iterated through in gameplay + * @param fps - integer of gameplay's frames per second + * @returns i - integer of frame to jump to + */ int brickbreaker_action(PauseOption choice, Gamepad &gamepad, N5110 &lcd, int frame, int fps); + /** + * @brief Display the help menu for classic game mode + * @param gamepad - Gamepad object to check for button press + * @param lcd - N5110 object to render help menu on LCD + */ void classic_help(Gamepad &gamepad, N5110 &lcd); + /** + * @brief Display the help menu for brickbreaker game mode + * @param gamepad - Gamepad object to check for button press + * @param lcd - N5110 object to render help menu on LCD + */ void brickbreaker_help(Gamepad &gamepad, N5110 &lcd); private: