ELEC2645 (2017/18) / Mbed OS el16ajm
Committer:
Andrew_M
Date:
Tue May 08 14:52:29 2018 +0000
Revision:
17:2a909f7da973
Parent:
15:130900e5c268
More comments and debugging tools added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Andrew_M 8:9d01fd4a63ad 1 #include "mbed.h"
Andrew_M 8:9d01fd4a63ad 2 #include "N5110.h"
Andrew_M 8:9d01fd4a63ad 3 #include "Gamepad.h"
Andrew_M 8:9d01fd4a63ad 4
Andrew_M 14:a57a40ff9430 5 /** The Menu class
Andrew_M 14:a57a40ff9430 6 * @brief Handles all logic and drawing related to the menu, doesn't set any selected options in the game engine directly
Andrew_M 14:a57a40ff9430 7 * @author Andrew J. Moore
Andrew_M 14:a57a40ff9430 8 * @date May, 2018
Andrew_M 14:a57a40ff9430 9 */
Andrew_M 14:a57a40ff9430 10
Andrew_M 9:fe86ddbf7799 11 class Menu
Andrew_M 8:9d01fd4a63ad 12 {
Andrew_M 8:9d01fd4a63ad 13 public:
Andrew_M 8:9d01fd4a63ad 14
Andrew_M 14:a57a40ff9430 15 /** Constructor */
Andrew_M 8:9d01fd4a63ad 16 Menu();
Andrew_M 14:a57a40ff9430 17
Andrew_M 14:a57a40ff9430 18 /** Destructor */
Andrew_M 8:9d01fd4a63ad 19 ~Menu();
Andrew_M 14:a57a40ff9430 20
Andrew_M 15:130900e5c268 21 /** Initialisation function */
Andrew_M 8:9d01fd4a63ad 22 void init();
Andrew_M 14:a57a40ff9430 23
Andrew_M 14:a57a40ff9430 24 /** Reads and stores the current inputs from the gamepad
Andrew_M 14:a57a40ff9430 25 * @param the current state of the gamepad (Gamepad)
Andrew_M 14:a57a40ff9430 26 */
Andrew_M 9:fe86ddbf7799 27 void read_input(Gamepad &pad);
Andrew_M 14:a57a40ff9430 28
Andrew_M 14:a57a40ff9430 29 /** Updates the current menu state */
Andrew_M 9:fe86ddbf7799 30 void update();
Andrew_M 14:a57a40ff9430 31
Andrew_M 14:a57a40ff9430 32 /** Draws the current state of the menu
Andrew_M 14:a57a40ff9430 33 * @param the LCD so that it can be drawn to (N5110)
Andrew_M 14:a57a40ff9430 34 */
Andrew_M 9:fe86ddbf7799 35 void draw(N5110 &lcd);
Andrew_M 14:a57a40ff9430 36
Andrew_M 14:a57a40ff9430 37 /** Gets if 'Start' has been selected in the menu
Andrew_M 14:a57a40ff9430 38 * @return the value of _start
Andrew_M 14:a57a40ff9430 39 */
Andrew_M 9:fe86ddbf7799 40 bool started();
Andrew_M 14:a57a40ff9430 41
Andrew_M 14:a57a40ff9430 42 /** Gets the current difficulty setting
Andrew_M 14:a57a40ff9430 43 * @return the value of _difficulty
Andrew_M 14:a57a40ff9430 44 */
Andrew_M 10:279d3775d52c 45 int getDif();
Andrew_M 14:a57a40ff9430 46
Andrew_M 14:a57a40ff9430 47 /** Gets the currently selected level
Andrew_M 14:a57a40ff9430 48 * @return the value of _level
Andrew_M 14:a57a40ff9430 49 */
Andrew_M 12:d3eef5ea3f43 50 int getLvl();
Andrew_M 8:9d01fd4a63ad 51
Andrew_M 8:9d01fd4a63ad 52
Andrew_M 8:9d01fd4a63ad 53 private:
Andrew_M 10:279d3775d52c 54
Andrew_M 14:a57a40ff9430 55 //Private Variables
Andrew_M 10:279d3775d52c 56 char _d;
Andrew_M 10:279d3775d52c 57 bool _start;
Andrew_M 10:279d3775d52c 58 int _mainSelection;
Andrew_M 10:279d3775d52c 59 int _difSelection;
Andrew_M 10:279d3775d52c 60 int _lvlSelection;
Andrew_M 10:279d3775d52c 61 bool _buttonPressed;
Andrew_M 10:279d3775d52c 62 string _menuScreen;
Andrew_M 10:279d3775d52c 63 int _difficulty;
Andrew_M 10:279d3775d52c 64 int _level;
Andrew_M 10:279d3775d52c 65
Andrew_M 14:a57a40ff9430 66 //Private Methods
Andrew_M 14:a57a40ff9430 67 void moveArrow();
Andrew_M 14:a57a40ff9430 68 void selectItem();
Andrew_M 10:279d3775d52c 69
Andrew_M 8:9d01fd4a63ad 70 };