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:
- 38:a85bc227b907
- Parent:
- 37:de1f584bce71
diff -r de1f584bce71 -r a85bc227b907 Options_Engine/OptionsEngine.h
--- a/Options_Engine/OptionsEngine.h Mon May 06 21:44:49 2019 +0000
+++ b/Options_Engine/OptionsEngine.h Thu May 09 01:09:18 2019 +0000
@@ -21,6 +21,46 @@
Option next_state[3]; /**< Array of enums for possible next option */
};
+/** Options Engine Class
+@brief Library to power the options menu
+@brief Features methods
+
+@author James Cummins
+
+@code
+
+#include "mbed.h"
+#include "OptionsEngine.h"
+
+//Create an engine object for the Options Menu
+OptionsEngine opt;
+Gamepad gamepad;
+N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
+Ball ball;
+
+int main(){
+ //Enum for the user's option choice initialised to first menu item (brightness)
+ Option choice = BRIGHTNESS;
+ while(!(gamepad.check_event(gamepad.A_PRESSED))){
+ //display options renders the options menu
+ //option selection renders the arrows which point to the current selection
+ lcd.clear();
+ opt.display_options(lcd);
+ choice = opt.option_selection(gamepad, lcd);
+ lcd.refresh();
+ //longer wait time than normal game fps to compensate for button bounce
+ wait(0.2);
+ }
+ //each menu option called by its respective enum
+ if(choice == BRIGHTNESS){ opt.change_brightness(gamepad, lcd); }
+ if(choice == BALL_SPEED){ opt.change_ball_speed(gamepad, lcd, ball); }
+ if(choice == HIGH_SCORES){ opt.view_high_scores(gamepad, lcd); }
+}
+
+@endcode
+
+*/
+
class OptionsEngine {
public: