Ben Evans University Second Year Project. Game Called Defender.
Embed:
(wiki syntax)
Show/hide line numbers
Menu.h
00001 #ifndef MENU_H 00002 #define MENU_H 00003 00004 // Included Headers ------------------------------------------------------------ 00005 #include "mbed.h" 00006 #include "N5110.h" 00007 #include "Gamepad.h" 00008 #include "Sprites.h" 00009 00010 /** Enum for defend menu parts*/ 00011 enum MenuParts {play, settings, saved_games, high_score, main_menu}; 00012 00013 /** scroll_orderStruct 00014 * @brief Struct hold differnt menu orders 00015 */ 00016 struct scroll_order { 00017 MenuParts part_previous; /**< Previous menu part */ 00018 MenuParts part_displayed; /**< Displayed menu part */ 00019 MenuParts part_next; /**< Next Menu part */ 00020 }; 00021 00022 /** Explosion class 00023 * @brief Selects and draws different menu parts 00024 * @author Benjamin Evans, University of Leeds 00025 * @date May 2020 00026 */ 00027 class Menu{ 00028 public: 00029 /** Constructor */ 00030 Menu(); 00031 00032 /** Destructor */ 00033 ~Menu(); 00034 00035 /** Initialises Menu*/ 00036 void init(); 00037 00038 /** Sets the current menu part to the displayed when a is pressed 00039 * @param pressed @details Bottom A pressed 00040 */ 00041 void select_part(bool pressed); 00042 00043 /** Draws the name of the part that is in the middle 00044 * @param lcd @details N5110 object 00045 */ 00046 void draw_part(N5110 &lcd); 00047 00048 /** Scrolls through the different menu parts 00049 * @param d_ @details Direction of joystick 00050 */ 00051 void menu_scroll(Direction d_); 00052 00053 // Accessors and mutators -------------------------------------------------- 00054 00055 /** Gets the current menu part that is selected 00056 * @return current_menu_part_ 00057 */ 00058 MenuParts get_current_menu_part(); 00059 00060 private: 00061 // Function prototypes ----------------------------------------------------- 00062 00063 /** Prints the tile screen by printing different letter sprites 00064 * @param lcd @details N5110 object 00065 */ 00066 void title_screen(N5110 &lcd); 00067 00068 /** Time-triggered interrupt to flash title screen */ 00069 void title_screen_isr(); 00070 00071 // Variables ---------------------------------------------------------------- 00072 00073 /** The part of the menu that is displayed */ 00074 MenuParts displayed_menu_part_; 00075 00076 /** The part of the menu that is currently selected and in */ 00077 MenuParts current_menu_part_; 00078 00079 /** Volatile flag for ISR */ 00080 volatile bool title_screen_flag_; 00081 00082 /** Define Ticker object for flash title screen */ 00083 Ticker ticker_title; 00084 }; 00085 #endif
Generated on Fri Aug 5 2022 06:55:07 by
1.7.2