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.
Menu/Menu.h
- Committer:
- evanso
- Date:
- 2020-05-17
- Revision:
- 41:5959256f4aab
- Parent:
- 40:71f947254fda
- Child:
- 43:d43759dbddb9
File content as of revision 41:5959256f4aab:
#ifndef MENU_H
#define MENU_H
// Included libraries ----------------------------------------------------------
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
/** Enum for diffent menu parts*/
enum MenuParts {play, settings, saved_games, main_menu};
/** scroll_orderStruct
* @brief Struct hold differnt menu orders
*/
struct scroll_order {
MenuParts part_next; /**< Next Menu part */
MenuParts part_displayed; /**< Displayed menu part */
};
/** Explosion class
* @brief Selects and draws differnt menu parts
* @author Benjamin Evans, University of Leeds
* @date May 2020
*/
class Menu{
public:
/** Constructor */
Menu();
/** Destructor */
~Menu();
/** Initalises Menu*/
void init();
/** sets the current menu part to the displayed when a is pressed
* @param lcd @details N5110 object
* @param pad @details Gamepad object
*/
void select_part(N5110 &lcd, Gamepad &pad);
/** Draws the name of the part that is in the middle
* @param lcd @details N5110 object
*/
void draw_part(N5110 &lcd);
/** Scrolls through the diffent menu parts
* @param pad @details Gamepad object
* @param d_ @details Direction of joystick
*/
void menu_scroll(Gamepad &pad, Direction d_);
// Accessors and mutators --------------------------------------------------
/** Gets the current menu part that is selected
* @return current_menu_part_
*/
MenuParts get_current_menu_part();
private:
// Varibles ----------------------------------------------------------------
/** The part of the menu that is displayed */
MenuParts displayed_menu_part_;
/** The part of the menu that is currently selected and in*/
MenuParts current_menu_part_;
};
#endif