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
menu/Menu.h@21:a0f3651f56c4, 2020-05-23 (annotated)
- Committer:
- el18jgb
- Date:
- Sat May 23 13:59:51 2020 +0000
- Revision:
- 21:a0f3651f56c4
- Parent:
- 19:33c77517cb88
polishing;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el18jgb | 14:66a1965318cb | 1 | #ifndef MENU_H |
| el18jgb | 14:66a1965318cb | 2 | #define MENU_H |
| el18jgb | 14:66a1965318cb | 3 | |
| el18jgb | 14:66a1965318cb | 4 | #include "mbed.h" |
| el18jgb | 14:66a1965318cb | 5 | #include "N5110.h" |
| el18jgb | 14:66a1965318cb | 6 | #include "Gamepad.h" |
| el18jgb | 19:33c77517cb88 | 7 | #include "Highscore.h" |
| el18jgb | 14:66a1965318cb | 8 | |
| el18jgb | 14:66a1965318cb | 9 | |
| el18jgb | 21:a0f3651f56c4 | 10 | /** Menu class |
| el18jgb | 21:a0f3651f56c4 | 11 | * @brief small main menu with instructions and highscore screen |
| el18jgb | 21:a0f3651f56c4 | 12 | * @author Joe Body, University of Leeds |
| el18jgb | 21:a0f3651f56c4 | 13 | * @date May 2020 |
| el18jgb | 21:a0f3651f56c4 | 14 | */ |
| el18jgb | 14:66a1965318cb | 15 | |
| el18jgb | 14:66a1965318cb | 16 | class Menu |
| el18jgb | 14:66a1965318cb | 17 | { |
| el18jgb | 14:66a1965318cb | 18 | |
| el18jgb | 14:66a1965318cb | 19 | public: |
| el18jgb | 21:a0f3651f56c4 | 20 | |
| el18jgb | 21:a0f3651f56c4 | 21 | /** Constructor */ |
| el18jgb | 14:66a1965318cb | 22 | Menu(); |
| el18jgb | 21:a0f3651f56c4 | 23 | |
| el18jgb | 21:a0f3651f56c4 | 24 | /** Destructor */ |
| el18jgb | 14:66a1965318cb | 25 | ~Menu(); |
| el18jgb | 21:a0f3651f56c4 | 26 | |
| el18jgb | 21:a0f3651f56c4 | 27 | /** Initalises Menu*/ |
| el18jgb | 14:66a1965318cb | 28 | void init(); |
| el18jgb | 21:a0f3651f56c4 | 29 | |
| el18jgb | 21:a0f3651f56c4 | 30 | /** displays the main menu |
| el18jgb | 21:a0f3651f56c4 | 31 | * @param lcd @details N5110 object |
| el18jgb | 21:a0f3651f56c4 | 32 | * @param pad @details Gamepad object |
| el18jgb | 21:a0f3651f56c4 | 33 | */ |
| el18jgb | 16:7c612029d9c9 | 34 | void display(N5110 &lcd, Gamepad &pad); |
| el18jgb | 21:a0f3651f56c4 | 35 | |
| el18jgb | 21:a0f3651f56c4 | 36 | /** Draws the spike |
| el18jgb | 21:a0f3651f56c4 | 37 | * @param lcd @details N5110 object |
| el18jgb | 21:a0f3651f56c4 | 38 | */ |
| el18jgb | 14:66a1965318cb | 39 | void draw(N5110 &lcd); |
| el18jgb | 21:a0f3651f56c4 | 40 | |
| el18jgb | 21:a0f3651f56c4 | 41 | /** updates the option |
| el18jgb | 21:a0f3651f56c4 | 42 | * @param pad @details Gamepad object |
| el18jgb | 21:a0f3651f56c4 | 43 | */ |
| el18jgb | 14:66a1965318cb | 44 | void update(Gamepad &pad); |
| el18jgb | 21:a0f3651f56c4 | 45 | |
| el18jgb | 21:a0f3651f56c4 | 46 | /** displays the instruction screen |
| el18jgb | 21:a0f3651f56c4 | 47 | * @param lcd @details N5110 object |
| el18jgb | 21:a0f3651f56c4 | 48 | * @param pad @details Gamepad object |
| el18jgb | 21:a0f3651f56c4 | 49 | */ |
| el18jgb | 14:66a1965318cb | 50 | void instructions(N5110 &lcd, Gamepad &pad); |
| el18jgb | 21:a0f3651f56c4 | 51 | |
| el18jgb | 21:a0f3651f56c4 | 52 | /** displays the highscore screen |
| el18jgb | 21:a0f3651f56c4 | 53 | * @param lcd @details N5110 object |
| el18jgb | 21:a0f3651f56c4 | 54 | * @param pad @details Gamepad object |
| el18jgb | 21:a0f3651f56c4 | 55 | * @param hs @details highscore class |
| el18jgb | 21:a0f3651f56c4 | 56 | * @param sd @details SD File System |
| el18jgb | 21:a0f3651f56c4 | 57 | */ |
| el18jgb | 19:33c77517cb88 | 58 | void highs_screen(N5110 &lcd, Gamepad &pad, Highscore &hs, SDFileSystem &sd); |
| el18jgb | 14:66a1965318cb | 59 | |
| el18jgb | 21:a0f3651f56c4 | 60 | /** gets the option */ |
| el18jgb | 16:7c612029d9c9 | 61 | int getmode(); |
| el18jgb | 16:7c612029d9c9 | 62 | |
| el18jgb | 14:66a1965318cb | 63 | private: |
| el18jgb | 14:66a1965318cb | 64 | |
| el18jgb | 21:a0f3651f56c4 | 65 | /** option corresponding to play, highscore or instruction*/ |
| el18jgb | 14:66a1965318cb | 66 | int option; |
| el18jgb | 14:66a1965318cb | 67 | |
| el18jgb | 21:a0f3651f56c4 | 68 | /** x position of sprite |
| el18jgb | 21:a0f3651f56c4 | 69 | * @return _x |
| el18jgb | 21:a0f3651f56c4 | 70 | */ |
| el18jgb | 14:66a1965318cb | 71 | int _x; |
| el18jgb | 21:a0f3651f56c4 | 72 | |
| el18jgb | 21:a0f3651f56c4 | 73 | /** y position of sprite |
| el18jgb | 21:a0f3651f56c4 | 74 | * @return _y |
| el18jgb | 21:a0f3651f56c4 | 75 | */ |
| el18jgb | 14:66a1965318cb | 76 | int _y; |
| el18jgb | 14:66a1965318cb | 77 | |
| el18jgb | 14:66a1965318cb | 78 | }; |
| el18jgb | 14:66a1965318cb | 79 | |
| el18jgb | 14:66a1965318cb | 80 | |
| el18jgb | 14:66a1965318cb | 81 | #endif |