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@4:035448357749, 2019-04-08 (annotated)
- Committer:
- ellisbhastroud
- Date:
- Mon Apr 08 15:10:28 2019 +0000
- Revision:
- 4:035448357749
- Parent:
- 3:a8960004d261
- Child:
- 5:0b31909caf7f
Settings section of menu fully 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 | |
| ellisbhastroud | 1:6179c2d67d19 | 9 | /** Menu Class |
| ellisbhastroud | 3:a8960004d261 | 10 | * @brief Library for navigating menu options |
| ellisbhastroud | 1:6179c2d67d19 | 11 | * @author Ellis Blackford Stroud |
| ellisbhastroud | 1:6179c2d67d19 | 12 | * @date May, 2018 |
| ellisbhastroud | 1:6179c2d67d19 | 13 | */ |
| ellisbhastroud | 1:6179c2d67d19 | 14 | |
| ellisbhastroud | 1:6179c2d67d19 | 15 | class Menu { |
| ellisbhastroud | 1:6179c2d67d19 | 16 | |
| ellisbhastroud | 1:6179c2d67d19 | 17 | public: |
| ellisbhastroud | 1:6179c2d67d19 | 18 | |
| ellisbhastroud | 1:6179c2d67d19 | 19 | /** Constructor */ |
| ellisbhastroud | 1:6179c2d67d19 | 20 | Menu(); |
| ellisbhastroud | 1:6179c2d67d19 | 21 | |
| ellisbhastroud | 1:6179c2d67d19 | 22 | /** Destructor */ |
| ellisbhastroud | 1:6179c2d67d19 | 23 | ~Menu(); |
| ellisbhastroud | 1:6179c2d67d19 | 24 | |
| ellisbhastroud | 3:a8960004d261 | 25 | void init(); |
| ellisbhastroud | 3:a8960004d261 | 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 | 1:6179c2d67d19 | 31 | void print_menu(N5110 &lcd); |
| ellisbhastroud | 1:6179c2d67d19 | 32 | |
| ellisbhastroud | 3:a8960004d261 | 33 | /** Prints start screen */ |
| ellisbhastroud | 3:a8960004d261 | 34 | bool check_start(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 3:a8960004d261 | 35 | |
| ellisbhastroud | 2:81cfa8310f55 | 36 | /** Prints highscore screen */ |
| ellisbhastroud | 4:035448357749 | 37 | void print_highscores(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 2:81cfa8310f55 | 38 | |
| ellisbhastroud | 2:81cfa8310f55 | 39 | /** Prints settings screen */ |
| ellisbhastroud | 4:035448357749 | 40 | void print_settings(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 4:035448357749 | 41 | |
| ellisbhastroud | 4:035448357749 | 42 | void draw_settings(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 2:81cfa8310f55 | 43 | |
| ellisbhastroud | 3:a8960004d261 | 44 | /** Changes screen to menu choice and returns start game message |
| ellisbhastroud | 3:a8960004d261 | 45 | * @returns a bool: true to start game, false to stay in menu |
| ellisbhastroud | 3:a8960004d261 | 46 | */ |
| ellisbhastroud | 3:a8960004d261 | 47 | bool menu_change(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 3:a8960004d261 | 48 | |
| ellisbhastroud | 3:a8960004d261 | 49 | /** Returns to menu screen */ |
| ellisbhastroud | 3:a8960004d261 | 50 | void menu_return(N5110 &lcd, Gamepad &pad); |
| ellisbhastroud | 3:a8960004d261 | 51 | |
| ellisbhastroud | 3:a8960004d261 | 52 | /** Updates cursor and returns menu choice |
| ellisbhastroud | 3:a8960004d261 | 53 | * @returns an enum: START, HIGHSCORES, SETTINGS |
| ellisbhastroud | 3:a8960004d261 | 54 | */ |
| ellisbhastroud | 3:a8960004d261 | 55 | void menu_select(Gamepad &pad, N5110 &lcd); |
| ellisbhastroud | 2:81cfa8310f55 | 56 | |
| ellisbhastroud | 4:035448357749 | 57 | void set_frame_rate(int frame_rate); |
| ellisbhastroud | 4:035448357749 | 58 | |
| ellisbhastroud | 4:035448357749 | 59 | void set_contrast(float contrast); |
| ellisbhastroud | 4:035448357749 | 60 | |
| ellisbhastroud | 4:035448357749 | 61 | void set_brightness(float brightness); |
| ellisbhastroud | 4:035448357749 | 62 | |
| ellisbhastroud | 4:035448357749 | 63 | int get_frame_rate(); |
| ellisbhastroud | 4:035448357749 | 64 | |
| ellisbhastroud | 4:035448357749 | 65 | float get_contrast(); |
| ellisbhastroud | 4:035448357749 | 66 | |
| ellisbhastroud | 4:035448357749 | 67 | float get_brightness(); |
| ellisbhastroud | 4:035448357749 | 68 | |
| ellisbhastroud | 2:81cfa8310f55 | 69 | |
| ellisbhastroud | 3:a8960004d261 | 70 | private: |
| ellisbhastroud | 2:81cfa8310f55 | 71 | |
| ellisbhastroud | 2:81cfa8310f55 | 72 | |
| ellisbhastroud | 3:a8960004d261 | 73 | void draw_cursor(N5110 &lcd); |
| ellisbhastroud | 3:a8960004d261 | 74 | |
| ellisbhastroud | 4:035448357749 | 75 | void move_cursor(N5110 &lcd); |
| ellisbhastroud | 4:035448357749 | 76 | |
| ellisbhastroud | 4:035448357749 | 77 | int _cursor_pos; |
| ellisbhastroud | 4:035448357749 | 78 | |
| ellisbhastroud | 4:035448357749 | 79 | float _pot; |
| ellisbhastroud | 4:035448357749 | 80 | |
| ellisbhastroud | 4:035448357749 | 81 | float _contrast; |
| ellisbhastroud | 4:035448357749 | 82 | |
| ellisbhastroud | 4:035448357749 | 83 | float _brightness; |
| ellisbhastroud | 4:035448357749 | 84 | |
| ellisbhastroud | 4:035448357749 | 85 | int _frame_rate; |
| ellisbhastroud | 4:035448357749 | 86 | |
| ellisbhastroud | 4:035448357749 | 87 | Direction _joy_direction; |
| ellisbhastroud | 4:035448357749 | 88 | |
| ellisbhastroud | 4:035448357749 | 89 | |
| ellisbhastroud | 1:6179c2d67d19 | 90 | |
| ellisbhastroud | 1:6179c2d67d19 | 91 | }; |
| ellisbhastroud | 1:6179c2d67d19 | 92 | |
| ellisbhastroud | 1:6179c2d67d19 | 93 | #endif |