zhenye yang
/
el17zy
Yang Zhenye 201199680
Menu/Menu.h@9:a5a82b3d1102, 2020-05-15 (annotated)
- Committer:
- yangzhenye
- Date:
- Fri May 15 07:27:23 2020 +0000
- Revision:
- 9:a5a82b3d1102
- Parent:
- 5:fcad75e9b9e1
el17zy Yang Zhenye
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yangzhenye | 2:baca89f466bc | 1 | #ifndef MENU_H |
yangzhenye | 2:baca89f466bc | 2 | #define MENU_H |
yangzhenye | 2:baca89f466bc | 3 | |
yangzhenye | 2:baca89f466bc | 4 | #include "mbed.h" |
yangzhenye | 2:baca89f466bc | 5 | #include "N5110.h" |
yangzhenye | 2:baca89f466bc | 6 | #include "Gamepad.h" |
yangzhenye | 4:eb8dca1dc341 | 7 | #include "RooneyEngine.h" |
yangzhenye | 2:baca89f466bc | 8 | |
yangzhenye | 2:baca89f466bc | 9 | struct State { |
yangzhenye | 2:baca89f466bc | 10 | int output; |
yangzhenye | 5:fcad75e9b9e1 | 11 | int next_state[4]; }; |
yangzhenye | 5:fcad75e9b9e1 | 12 | |
yangzhenye | 2:baca89f466bc | 13 | class Menu { |
yangzhenye | 2:baca89f466bc | 14 | public: |
yangzhenye | 5:fcad75e9b9e1 | 15 | // Constructor and destructor. |
yangzhenye | 5:fcad75e9b9e1 | 16 | /** |
yangzhenye | 5:fcad75e9b9e1 | 17 | * @brief Constructor @details Non user specified. |
yangzhenye | 5:fcad75e9b9e1 | 18 | */ |
yangzhenye | 2:baca89f466bc | 19 | Menu(); |
yangzhenye | 5:fcad75e9b9e1 | 20 | /** |
yangzhenye | 5:fcad75e9b9e1 | 21 | * @brief Destructor @details Non user specified. |
yangzhenye | 5:fcad75e9b9e1 | 22 | */ |
yangzhenye | 2:baca89f466bc | 23 | ~Menu(); |
yangzhenye | 9:a5a82b3d1102 | 24 | // Mutators |
yangzhenye | 9:a5a82b3d1102 | 25 | /** |
yangzhenye | 9:a5a82b3d1102 | 26 | * @brief Initialises the Menu. |
yangzhenye | 9:a5a82b3d1102 | 27 | */ |
yangzhenye | 2:baca89f466bc | 28 | void init(); |
yangzhenye | 9:a5a82b3d1102 | 29 | /** |
yangzhenye | 9:a5a82b3d1102 | 30 | * @brief Runs the menu and a state machine. |
yangzhenye | 9:a5a82b3d1102 | 31 | * @param &lcd @details The lcd object from the N5110 class |
yangzhenye | 9:a5a82b3d1102 | 32 | * @param &gamepad @details The gamepad object from Gamepad class |
yangzhenye | 9:a5a82b3d1102 | 33 | */ |
yangzhenye | 5:fcad75e9b9e1 | 34 | void run_engine(N5110 &lcd, Gamepad &gamepad); |
yangzhenye | 9:a5a82b3d1102 | 35 | /** |
yangzhenye | 9:a5a82b3d1102 | 36 | * @brief Runs the game. |
yangzhenye | 9:a5a82b3d1102 | 37 | * @param &lcd @details The lcd object from the N5110 class |
yangzhenye | 9:a5a82b3d1102 | 38 | * @param &gamepad @details The gamepad object from Gamepad class |
yangzhenye | 9:a5a82b3d1102 | 39 | */ |
yangzhenye | 5:fcad75e9b9e1 | 40 | void run_game(N5110 &lcd, Gamepad &gamepad); |
yangzhenye | 2:baca89f466bc | 41 | |
yangzhenye | 2:baca89f466bc | 42 | private: |
yangzhenye | 5:fcad75e9b9e1 | 43 | void display_page1(N5110 &lcd, Gamepad &gamepad); |
yangzhenye | 9:a5a82b3d1102 | 44 | // void display_page2(N5110 &lcd, Gamepad &gamepad); |
yangzhenye | 5:fcad75e9b9e1 | 45 | void display_page3(N5110 &lcd, Gamepad &gamepad); |
yangzhenye | 5:fcad75e9b9e1 | 46 | void get_output(N5110 &lcd, Gamepad &gamepad); |
yangzhenye | 5:fcad75e9b9e1 | 47 | void get_input(bool start, bool back, bool x); |
yangzhenye | 2:baca89f466bc | 48 | int _output; |
yangzhenye | 2:baca89f466bc | 49 | int _state; |
yangzhenye | 2:baca89f466bc | 50 | int _input; |
yangzhenye | 5:fcad75e9b9e1 | 51 | RooneyEngine _engine; |
yangzhenye | 2:baca89f466bc | 52 | }; |
yangzhenye | 2:baca89f466bc | 53 | #endif |
yangzhenye | 2:baca89f466bc | 54 |