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@13:681192091568, 2019-05-06 (annotated)
- Committer:
- ellisbhastroud
- Date:
- Mon May 06 10:00:57 2019 +0000
- Revision:
- 13:681192091568
- Parent:
- 12:7f7fadb5c106
- Child:
- 14:08ac9aaa34c3
Highscores now fully implemented. Scores written to file at end of game. Highscores section in menu now reads, sorts and displays scores stored in SD card file.
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 | 13:681192091568 | 7 | #include "SDFileSystem.h" |
| ellisbhastroud | 13:681192091568 | 8 | #include <algorithm> |
| ellisbhastroud | 1:6179c2d67d19 | 9 | |
| ellisbhastroud | 1:6179c2d67d19 | 10 | /** Menu Class |
| ellisbhastroud | 3:a8960004d261 | 11 | * @brief Library for navigating menu options |
| ellisbhastroud | 1:6179c2d67d19 | 12 | * @author Ellis Blackford Stroud |
| ellisbhastroud | 1:6179c2d67d19 | 13 | * @date May, 2018 |
| ellisbhastroud | 1:6179c2d67d19 | 14 | */ |
| ellisbhastroud | 1:6179c2d67d19 | 15 | |
| ellisbhastroud | 1:6179c2d67d19 | 16 | class Menu { |
| ellisbhastroud | 1:6179c2d67d19 | 17 | |
| ellisbhastroud | 1:6179c2d67d19 | 18 | public: |
| ellisbhastroud | 1:6179c2d67d19 | 19 | |
| ellisbhastroud | 1:6179c2d67d19 | 20 | /** Constructor */ |
| ellisbhastroud | 1:6179c2d67d19 | 21 | Menu(); |
| ellisbhastroud | 1:6179c2d67d19 | 22 | |
| ellisbhastroud | 1:6179c2d67d19 | 23 | /** Destructor */ |
| ellisbhastroud | 1:6179c2d67d19 | 24 | ~Menu(); |
| ellisbhastroud | 12:7f7fadb5c106 | 25 | |
| ellisbhastroud | 12:7f7fadb5c106 | 26 | /** Sets class variables initial values */ |
| ellisbhastroud | 3:a8960004d261 | 27 | void init(); |
| ellisbhastroud | 12:7f7fadb5c106 | 28 | |
| ellisbhastroud | 1:6179c2d67d19 | 29 | /** Prints opening message */ |
| ellisbhastroud | 1:6179c2d67d19 | 30 | void print_welcome(N5110 &lcd); |
| ellisbhastroud | 1:6179c2d67d19 | 31 | |
| ellisbhastroud | 1:6179c2d67d19 | 32 | /** Prints menu screen */ |
| ellisbhastroud | 13:681192091568 | 33 | bool menu_loop(Gamepad &pad, N5110 &lcd, SDFileSystem &sd); |
| ellisbhastroud | 2:81cfa8310f55 | 34 | |
| ellisbhastroud | 13:681192091568 | 35 | void highscores_loop(Gamepad &pad, N5110 &lcd, SDFileSystem &sd); |
| ellisbhastroud | 13:681192091568 | 36 | |
| ellisbhastroud | 12:7f7fadb5c106 | 37 | /** Returns frame rate |
| ellisbhastroud | 12:7f7fadb5c106 | 38 | * @returns frame rate chosen in settings |
| ellisbhastroud | 12:7f7fadb5c106 | 39 | */ |
| ellisbhastroud | 4:035448357749 | 40 | int get_frame_rate(); |
| ellisbhastroud | 4:035448357749 | 41 | |
| ellisbhastroud | 12:7f7fadb5c106 | 42 | private: |
| ellisbhastroud | 2:81cfa8310f55 | 43 | |
| ellisbhastroud | 13:681192091568 | 44 | void read_input(Gamepad &pad); |
| ellisbhastroud | 13:681192091568 | 45 | |
| ellisbhastroud | 13:681192091568 | 46 | void sd_read(SDFileSystem &sd); |
| ellisbhastroud | 13:681192091568 | 47 | |
| ellisbhastroud | 13:681192091568 | 48 | bool menu_change(Gamepad &pad, N5110 &lcd, SDFileSystem &sd); |
| ellisbhastroud | 13:681192091568 | 49 | |
| ellisbhastroud | 13:681192091568 | 50 | bool start_loop(Gamepad &pad, N5110 &lcd); |
| ellisbhastroud | 13:681192091568 | 51 | |
| ellisbhastroud | 13:681192091568 | 52 | void settings_loop(Gamepad &pad, N5110 &lcd, SDFileSystem &sd); |
| ellisbhastroud | 13:681192091568 | 53 | |
| ellisbhastroud | 13:681192091568 | 54 | void drawSettings(N5110 &lcd); |
| ellisbhastroud | 2:81cfa8310f55 | 55 | |
| ellisbhastroud | 12:7f7fadb5c106 | 56 | void drawSettingsBars(N5110 &lcd); |
| ellisbhastroud | 3:a8960004d261 | 57 | |
| ellisbhastroud | 4:035448357749 | 58 | void move_cursor(N5110 &lcd); |
| ellisbhastroud | 13:681192091568 | 59 | |
| ellisbhastroud | 12:7f7fadb5c106 | 60 | void drawCursor(N5110 &lcd); |
| ellisbhastroud | 12:7f7fadb5c106 | 61 | |
| ellisbhastroud | 4:035448357749 | 62 | int _cursor_pos; |
| ellisbhastroud | 4:035448357749 | 63 | |
| ellisbhastroud | 4:035448357749 | 64 | float _pot; |
| ellisbhastroud | 4:035448357749 | 65 | |
| ellisbhastroud | 4:035448357749 | 66 | float _contrast; |
| ellisbhastroud | 4:035448357749 | 67 | |
| ellisbhastroud | 4:035448357749 | 68 | float _brightness; |
| ellisbhastroud | 4:035448357749 | 69 | |
| ellisbhastroud | 4:035448357749 | 70 | int _frame_rate; |
| ellisbhastroud | 4:035448357749 | 71 | |
| ellisbhastroud | 13:681192091568 | 72 | int *_highscores_array; |
| ellisbhastroud | 13:681192091568 | 73 | |
| ellisbhastroud | 4:035448357749 | 74 | Direction _joy_direction; |
| ellisbhastroud | 1:6179c2d67d19 | 75 | |
| ellisbhastroud | 1:6179c2d67d19 | 76 | }; |
| ellisbhastroud | 1:6179c2d67d19 | 77 | |
| ellisbhastroud | 1:6179c2d67d19 | 78 | #endif |