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.
Options_Engine/OptionsEngine.h@23:61fa82f76808, 2019-04-18 (annotated)
- Committer:
- JamesCummins
- Date:
- Thu Apr 18 22:56:34 2019 +0000
- Revision:
- 23:61fa82f76808
- Parent:
- 22:4e305ff8a050
- Child:
- 24:c6415cc74b17
Set ball speed issue fixed by creating a single ball object in top level file and referring back to that, rather than 2 different ones which don't communicate
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| JamesCummins | 22:4e305ff8a050 | 1 | #ifndef OPTIONSENGINE_H | 
| JamesCummins | 22:4e305ff8a050 | 2 | #define OPTIONSENGINE_H | 
| JamesCummins | 22:4e305ff8a050 | 3 | |
| JamesCummins | 22:4e305ff8a050 | 4 | #include "mbed.h" | 
| JamesCummins | 22:4e305ff8a050 | 5 | #include "Gamepad.h" | 
| JamesCummins | 22:4e305ff8a050 | 6 | #include "N5110.h" | 
| JamesCummins | 22:4e305ff8a050 | 7 | #include "Ball.h" | 
| JamesCummins | 22:4e305ff8a050 | 8 | |
| JamesCummins | 22:4e305ff8a050 | 9 | enum Option{ | 
| JamesCummins | 22:4e305ff8a050 | 10 | BRIGHTNESS, | 
| JamesCummins | 22:4e305ff8a050 | 11 | BALL_SPEED, | 
| JamesCummins | 22:4e305ff8a050 | 12 | HIGH_SCORES | 
| JamesCummins | 22:4e305ff8a050 | 13 | }; | 
| JamesCummins | 22:4e305ff8a050 | 14 | |
| JamesCummins | 22:4e305ff8a050 | 15 | struct OptionSelection{ | 
| JamesCummins | 22:4e305ff8a050 | 16 | int output; | 
| JamesCummins | 22:4e305ff8a050 | 17 | Option next_state[3]; | 
| JamesCummins | 22:4e305ff8a050 | 18 | }; | 
| JamesCummins | 22:4e305ff8a050 | 19 | |
| JamesCummins | 22:4e305ff8a050 | 20 | class OptionsEngine { | 
| JamesCummins | 22:4e305ff8a050 | 21 | |
| JamesCummins | 22:4e305ff8a050 | 22 | public: | 
| JamesCummins | 22:4e305ff8a050 | 23 | OptionsEngine(); //constructor | 
| JamesCummins | 22:4e305ff8a050 | 24 | ~OptionsEngine(); //destructor | 
| JamesCummins | 22:4e305ff8a050 | 25 | void init(); //initialiser | 
| JamesCummins | 23:61fa82f76808 | 26 | void options_menu(Gamepad &gamepad, N5110 &lcd, Ball &ball); | 
| JamesCummins | 22:4e305ff8a050 | 27 | void change_brightness(Gamepad &gamepad, N5110 &lcd); | 
| JamesCummins | 23:61fa82f76808 | 28 | void change_ball_speed(Gamepad &gamepad, N5110 &lcd, Ball &ball); | 
| JamesCummins | 22:4e305ff8a050 | 29 | |
| JamesCummins | 22:4e305ff8a050 | 30 | private: | 
| JamesCummins | 22:4e305ff8a050 | 31 | void display_options(N5110 &lcd); | 
| JamesCummins | 22:4e305ff8a050 | 32 | Option option_selection(Gamepad &gamepad, N5110 &lcd); | 
| JamesCummins | 22:4e305ff8a050 | 33 | void read_brightness_input(Gamepad &gamepad); | 
| JamesCummins | 23:61fa82f76808 | 34 | void read_ball_speed_input(Gamepad &gamepad); | 
| JamesCummins | 22:4e305ff8a050 | 35 | Option _state; | 
| JamesCummins | 22:4e305ff8a050 | 36 | int _next_state; | 
| JamesCummins | 22:4e305ff8a050 | 37 | float _brightness; | 
| JamesCummins | 22:4e305ff8a050 | 38 | int _ball_speed; | 
| JamesCummins | 22:4e305ff8a050 | 39 | |
| JamesCummins | 22:4e305ff8a050 | 40 | }; | 
| JamesCummins | 22:4e305ff8a050 | 41 | #endif |