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.
Dependencies: mbed FATFileSystem
Menu/Menu.h@12:7f7fadb5c106, 2019-05-03 (annotated)
- Committer:
- ellisbhastroud
- Date:
- Fri May 03 09:39:24 2019 +0000
- Revision:
- 12:7f7fadb5c106
- Parent:
- 5:0b31909caf7f
- Child:
- 13:681192091568
Added more detailed in line comments. Added Doxygen comments for classes. Reorganised some class methods. Removed unnecessary methods. Split large methods into multiple smaller.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ellisbhastroud | 1:6179c2d67d19 | 1 | #ifndef MENU_H |
| ellisbhastroud | 1:6179c2d67d19 | 2 | #define MENU_H |
| ellisbhastroud | 1:6179c2d67d19 | 3 | |
| ellisbhastroud | 1:6179c2d67d19 | 4 | #include "mbed.h" |
| ellisbhastroud | 1:6179c2d67d19 | 5 | #include "N5110.h" |
| ellisbhastroud | 1:6179c2d67d19 | 6 | #include "Gamepad.h" |
| ellisbhastroud | 1:6179c2d67d19 | 7 | |
| ellisbhastroud | 1:6179c2d67d19 | 8 | /** Menu Class |
| ellisbhastroud | 3:a8960004d261 | 9 | * @brief Library for navigating menu options |
| ellisbhastroud | 1:6179c2d67d19 | 10 | * @author Ellis Blackford Stroud |
| ellisbhastroud | 1:6179c2d67d19 | 11 | * @date May, 2018 |
| ellisbhastroud | 1:6179c2d67d19 | 12 | */ |
| ellisbhastroud | 1:6179c2d67d19 | 13 | |
| ellisbhastroud | 1:6179c2d67d19 | 14 | class Menu { |
| ellisbhastroud | 1:6179c2d67d19 | 15 | |
| ellisbhastroud | 1:6179c2d67d19 | 16 | public: |
| ellisbhastroud | 1:6179c2d67d19 | 17 | |
| ellisbhastroud | 1:6179c2d67d19 | 18 | /** Constructor */ |
| ellisbhastroud | 1:6179c2d67d19 | 19 | Menu(); |
| ellisbhastroud | 1:6179c2d67d19 | 20 | |
| ellisbhastroud | 1:6179c2d67d19 | 21 | /** Destructor */ |
| ellisbhastroud | 1:6179c2d67d19 | 22 | ~Menu(); |
| ellisbhastroud | 12:7f7fadb5c106 | 23 | |
| ellisbhastroud | 12:7f7fadb5c106 | 24 | /** Sets class variables initial values */ |
| ellisbhastroud | 3:a8960004d261 | 25 | void init(); |
| ellisbhastroud | 12:7f7fadb5c106 | 26 | |
| ellisbhastroud | 1:6179c2d67d19 | 27 | /** Prints opening message */ |
| ellisbhastroud | 1:6179c2d67d19 | 28 | void print_welcome(N5110 &lcd); |
| ellisbhastroud | 1:6179c2d67d19 | 29 | |
| ellisbhastroud | 1:6179c2d67d19 | 30 | /** Prints menu screen */ |
| ellisbhastroud | 5:0b31909caf7f | 31 | void menu_screen(Gamepad &pad, N5110 &lcd); |
| ellisbhastroud | 1:6179c2d67d19 | 32 | |
| ellisbhastroud | 3:a8960004d261 | 33 | /** Prints start screen */ |
| ellisbhastroud | 5:0b31909caf7f | 34 | bool start_screen(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 3:a8960004d261 | 35 | |
| ellisbhastroud | 2:81cfa8310f55 | 36 | /** Prints highscore screen */ |
| ellisbhastroud | 5:0b31909caf7f | 37 | void highscores_screen(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 2:81cfa8310f55 | 38 | |
| ellisbhastroud | 2:81cfa8310f55 | 39 | /** Prints settings screen */ |
| ellisbhastroud | 5:0b31909caf7f | 40 | void settings_screen(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 12:7f7fadb5c106 | 41 | |
| ellisbhastroud | 3:a8960004d261 | 42 | /** Changes screen to menu choice and returns start game message |
| ellisbhastroud | 3:a8960004d261 | 43 | * @returns a bool: true to start game, false to stay in menu |
| ellisbhastroud | 3:a8960004d261 | 44 | */ |
| ellisbhastroud | 3:a8960004d261 | 45 | bool menu_change(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 3:a8960004d261 | 46 | |
| ellisbhastroud | 12:7f7fadb5c106 | 47 | /** Updates cursor and returns menu choice*/ |
| ellisbhastroud | 5:0b31909caf7f | 48 | void cursor_select(Gamepad &pad, N5110 &lcd); |
| ellisbhastroud | 12:7f7fadb5c106 | 49 | |
| ellisbhastroud | 12:7f7fadb5c106 | 50 | /** Returns frame rate |
| ellisbhastroud | 12:7f7fadb5c106 | 51 | * @returns frame rate chosen in settings |
| ellisbhastroud | 12:7f7fadb5c106 | 52 | */ |
| ellisbhastroud | 4:035448357749 | 53 | int get_frame_rate(); |
| ellisbhastroud | 4:035448357749 | 54 | |
| ellisbhastroud | 12:7f7fadb5c106 | 55 | private: |
| ellisbhastroud | 2:81cfa8310f55 | 56 | |
| ellisbhastroud | 12:7f7fadb5c106 | 57 | void drawSettings(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 2:81cfa8310f55 | 58 | |
| ellisbhastroud | 12:7f7fadb5c106 | 59 | void drawSettingsBars(N5110 &lcd); |
| ellisbhastroud | 3:a8960004d261 | 60 | |
| ellisbhastroud | 4:035448357749 | 61 | void move_cursor(N5110 &lcd); |
| ellisbhastroud | 4:035448357749 | 62 | |
| ellisbhastroud | 12:7f7fadb5c106 | 63 | void drawCursor(N5110 &lcd); |
| ellisbhastroud | 12:7f7fadb5c106 | 64 | |
| ellisbhastroud | 4:035448357749 | 65 | int _cursor_pos; |
| ellisbhastroud | 4:035448357749 | 66 | |
| ellisbhastroud | 4:035448357749 | 67 | float _pot; |
| ellisbhastroud | 4:035448357749 | 68 | |
| ellisbhastroud | 4:035448357749 | 69 | float _contrast; |
| ellisbhastroud | 4:035448357749 | 70 | |
| ellisbhastroud | 4:035448357749 | 71 | float _brightness; |
| ellisbhastroud | 4:035448357749 | 72 | |
| ellisbhastroud | 4:035448357749 | 73 | int _frame_rate; |
| ellisbhastroud | 4:035448357749 | 74 | |
| ellisbhastroud | 4:035448357749 | 75 | Direction _joy_direction; |
| ellisbhastroud | 1:6179c2d67d19 | 76 | |
| ellisbhastroud | 1:6179c2d67d19 | 77 | }; |
| ellisbhastroud | 1:6179c2d67d19 | 78 | |
| ellisbhastroud | 1:6179c2d67d19 | 79 | #endif |