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@5:0b31909caf7f, 2019-04-17 (annotated)
- Committer:
- ellisbhastroud
- Date:
- Wed Apr 17 10:27:09 2019 +0000
- Revision:
- 5:0b31909caf7f
- Parent:
- 4:035448357749
- Child:
- 12:7f7fadb5c106
Levels Added Not functioning
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 | 1:6179c2d67d19 | 23 | |
| ellisbhastroud | 3:a8960004d261 | 24 | void init(); |
| ellisbhastroud | 3:a8960004d261 | 25 | |
| ellisbhastroud | 1:6179c2d67d19 | 26 | /** Prints opening message */ |
| ellisbhastroud | 1:6179c2d67d19 | 27 | void print_welcome(N5110 &lcd); |
| ellisbhastroud | 1:6179c2d67d19 | 28 | |
| ellisbhastroud | 1:6179c2d67d19 | 29 | /** Prints menu screen */ |
| ellisbhastroud | 5:0b31909caf7f | 30 | void menu_screen(Gamepad &pad, N5110 &lcd); |
| ellisbhastroud | 1:6179c2d67d19 | 31 | |
| ellisbhastroud | 3:a8960004d261 | 32 | /** Prints start screen */ |
| ellisbhastroud | 5:0b31909caf7f | 33 | bool start_screen(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 3:a8960004d261 | 34 | |
| ellisbhastroud | 2:81cfa8310f55 | 35 | /** Prints highscore screen */ |
| ellisbhastroud | 5:0b31909caf7f | 36 | void highscores_screen(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 2:81cfa8310f55 | 37 | |
| ellisbhastroud | 2:81cfa8310f55 | 38 | /** Prints settings screen */ |
| ellisbhastroud | 5:0b31909caf7f | 39 | void settings_screen(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 4:035448357749 | 40 | |
| ellisbhastroud | 4:035448357749 | 41 | void draw_settings(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 2:81cfa8310f55 | 42 | |
| ellisbhastroud | 3:a8960004d261 | 43 | /** Changes screen to menu choice and returns start game message |
| ellisbhastroud | 3:a8960004d261 | 44 | * @returns a bool: true to start game, false to stay in menu |
| ellisbhastroud | 3:a8960004d261 | 45 | */ |
| ellisbhastroud | 3:a8960004d261 | 46 | bool menu_change(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 3:a8960004d261 | 47 | |
| ellisbhastroud | 3:a8960004d261 | 48 | /** Updates cursor and returns menu choice |
| ellisbhastroud | 3:a8960004d261 | 49 | * @returns an enum: START, HIGHSCORES, SETTINGS |
| ellisbhastroud | 3:a8960004d261 | 50 | */ |
| ellisbhastroud | 5:0b31909caf7f | 51 | void cursor_select(Gamepad &pad, N5110 &lcd); |
| ellisbhastroud | 2:81cfa8310f55 | 52 | |
| ellisbhastroud | 4:035448357749 | 53 | void set_frame_rate(int frame_rate); |
| ellisbhastroud | 4:035448357749 | 54 | |
| ellisbhastroud | 4:035448357749 | 55 | void set_contrast(float contrast); |
| ellisbhastroud | 4:035448357749 | 56 | |
| ellisbhastroud | 4:035448357749 | 57 | void set_brightness(float brightness); |
| ellisbhastroud | 4:035448357749 | 58 | |
| ellisbhastroud | 4:035448357749 | 59 | int get_frame_rate(); |
| ellisbhastroud | 4:035448357749 | 60 | |
| ellisbhastroud | 4:035448357749 | 61 | float get_contrast(); |
| ellisbhastroud | 4:035448357749 | 62 | |
| ellisbhastroud | 4:035448357749 | 63 | float get_brightness(); |
| ellisbhastroud | 4:035448357749 | 64 | |
| ellisbhastroud | 2:81cfa8310f55 | 65 | |
| ellisbhastroud | 3:a8960004d261 | 66 | private: |
| ellisbhastroud | 2:81cfa8310f55 | 67 | |
| ellisbhastroud | 2:81cfa8310f55 | 68 | |
| ellisbhastroud | 3:a8960004d261 | 69 | void draw_cursor(N5110 &lcd); |
| ellisbhastroud | 3:a8960004d261 | 70 | |
| ellisbhastroud | 4:035448357749 | 71 | void move_cursor(N5110 &lcd); |
| ellisbhastroud | 4:035448357749 | 72 | |
| ellisbhastroud | 4:035448357749 | 73 | int _cursor_pos; |
| ellisbhastroud | 4:035448357749 | 74 | |
| ellisbhastroud | 4:035448357749 | 75 | float _pot; |
| ellisbhastroud | 4:035448357749 | 76 | |
| ellisbhastroud | 4:035448357749 | 77 | float _contrast; |
| ellisbhastroud | 4:035448357749 | 78 | |
| ellisbhastroud | 4:035448357749 | 79 | float _brightness; |
| ellisbhastroud | 4:035448357749 | 80 | |
| ellisbhastroud | 4:035448357749 | 81 | int _frame_rate; |
| ellisbhastroud | 4:035448357749 | 82 | |
| ellisbhastroud | 4:035448357749 | 83 | Direction _joy_direction; |
| ellisbhastroud | 1:6179c2d67d19 | 84 | |
| ellisbhastroud | 1:6179c2d67d19 | 85 | }; |
| ellisbhastroud | 1:6179c2d67d19 | 86 | |
| ellisbhastroud | 1:6179c2d67d19 | 87 | #endif |