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: Options_Engine/OptionsEngine.h
- Revision:
- 37:de1f584bce71
- Parent:
- 35:138ad0faa42b
- Child:
- 38:a85bc227b907
--- a/Options_Engine/OptionsEngine.h Mon May 06 00:05:52 2019 +0000
+++ b/Options_Engine/OptionsEngine.h Mon May 06 21:44:49 2019 +0000
@@ -8,27 +8,68 @@
#include "Pause.h"
#include "SDFileSystem.h"
+/** Enum for choice currently selected in Options Menu*/
enum Option{
- BRIGHTNESS,
- BALL_SPEED,
- HIGH_SCORES
+ BRIGHTNESS, /**<Top menu option*/
+ BALL_SPEED, /**<Middle menu option*/
+ HIGH_SCORES /**<Bottom menu option*/
};
+/** Option Selection struct*/
struct OptionSelection{
- int output;
- Option next_state[3];
+ int output; /**< Integer output for line to print arrows */
+ Option next_state[3]; /**< Array of enums for possible next option */
};
class OptionsEngine {
public:
- OptionsEngine(); //constructor
- ~OptionsEngine(); //destructor
- void init(); //initialiser
+ /**
+ * @brief Create an engine object for the Options menu
+ */
+ OptionsEngine();
+ /**
+ * @brief Delete an Options Engine object to free up memory
+ */
+ ~OptionsEngine();
+ /**
+ * @brief Initialise Options menu settings. Set brightness to 50%, set initial
+ * option to the top one in the list, and set ball speed sensitivity to 5/10
+ */
+ void init();
+ /**
+ * @brief Render the options menu on the LCD screen
+ * @param lcd - N5110 object to interact with LCD screen
+ */
void display_options(N5110 &lcd);
+ /**
+ * @brief Read the user input, highlight and store the current option on the screen
+ * @param gamepad - Gamepad object to read the user input
+ * @param lcd - N5110 object to display arrows on LCD screen
+ * @returns an Enum of the option selected - BRIGHTNESS, BALL_SPEED or HIGH_SCORES
+ */
Option option_selection(Gamepad &gamepad, N5110 &lcd);
+ /**
+ * @brief Set the brightness of the LCD screen
+ * @param gamepad - Gamepad object to detect button press
+ * @param lcd - N5110 object to alter brightness and display graphic interface
+ */
void change_brightness(Gamepad &gamepad, N5110 &lcd);
+ /**
+ * @brief Set the ball speed multiplier
+ * @param gamepad - Gamepad object to detect button press
+ * @param lcd - N5110 object to display graphic interface
+ * @details ball speed is a continual multiplier to the values sensed by the
+ * accelerometer, altering the sensitivity of the sensed input
+ * (i.e the same change in tilt causes a greater change in the
+ * ball's position
+ */
void change_ball_speed(Gamepad &gamepad, N5110 &lcd, Ball &ball);
+ /**
+ * @brief Display the high scores for the selected game mode on the LCD screen
+ * @param gamepad - Gamepad object to sense user's selection
+ * @param lcd - N5110 object to display chosen leaderboard on LCD Screen
+ */
void view_high_scores(Gamepad &gamepad, N5110 &lcd);
private: