ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UX.h Source File

UX.h

00001 #ifndef UX_H
00002 #define UX_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 
00008 /**UX Class
00009 * @author Shahid Zubin Sajid
00010 * @brief Class for menus and displays for user convenience
00011 * @date May 2019
00012 */
00013 
00014 class UX
00015 {
00016 
00017 public:
00018     /** Constructor */
00019     UX();
00020     /** Deconstructor */
00021     ~UX();
00022     /**
00023     * @brief Initlialises the UX class
00024     */
00025     void init();
00026     /**
00027     * @brief checks if the Button A is pressed
00028     * @returns returns an int, 1 if the button is pressed 0 if false
00029     */
00030     int get_a_pressed();
00031     /**
00032     * @brief checks if the Button L is pressed
00033     * @returns returns an int, 1 if the button is pressed 0 if false
00034     */
00035     int get_l_pressed();
00036     /**
00037     *@brief prints the introuction screen for the game
00038     *@param &menu_lcd @details reference object for a N5110 class object
00039     */
00040     void first_menu(N5110 &menu_lcd);
00041     /**
00042     *@brief prints options menu and takes user input for which option they would like to choose
00043     *@param &menu_lcd @details reference object for a N5110 class object
00044     */
00045     void second_menu(N5110 &menu_lcd);
00046      /**
00047     *@brief prints options menu and takes user input for which option they would like to choose
00048     *@param &menu_lcd @details reference object for a N5110 class object
00049     */
00050     void menu_options(N5110 &menu_lcd);
00051      /**
00052     *@brief prints the rules for the game across multiple displays
00053     *@param &menu_lcd @details reference object for a N5110 class object
00054     */
00055     void rules_menu(N5110 &menu_lcd);
00056      /**
00057     *@brief prints the controls for the game across 3 displays
00058     *@param &menu_lcd @details reference object for a N5110 class object
00059     */
00060     void controls_menu(N5110 &menu_lcd);
00061      /**
00062     *@brief prints the screen for when game is over
00063     *@param &menu_lcd @details reference object for a N5110 class object
00064     *@param option @details option integer which denotes the manner in which the batsman was out
00065     */
00066     void game_over_menu(N5110 &menu_lcd,int option);
00067      /**
00068     *@brief prints the screen when player wins the game
00069     *@param &menu_lcd @details reference object for a N5110 class object
00070     */
00071     void victory_menu(N5110 &menu_lcd);
00072     /**
00073     *@brief Prints the rules for the game on the screen, called in rules_menu()
00074     *@param &menu_lcd @details reference object for a N5110 class object
00075     */
00076     void rules_menu_game(N5110 &menu_lcd);
00077     /**
00078     *@brief Prints the rules for scoring runs during the game
00079     *@param &menu_lcd @details reference object for a N5110 class object
00080     */
00081     void rules_menu_screen_out(N5110 &menu_lcd);
00082     /**
00083     *@brief Prints the rules for how a player can get out and lose the game
00084     *@param &menu_lcd @details reference object for a N5110 class object
00085     */
00086     void rules_menu_screen_scoring_runs(N5110 &menu_lcd);
00087     /**
00088     * @brief resets the button_pressed boolean variable to false    
00089     */
00090     void reset();
00091 
00092 private:
00093     /**Seperate Gamepad has been used in this class because Gamepad obect
00094      from the main class had issues with the CHECK_EVENT Function. The function was not responsive
00095      and could not be resolved and as a result the only suitable solution was to create another object
00096      this explains why a ux object was passed in the Bat class to check if ball was hit or lofted as the
00097      CHECK_EVENT was not responsive in the BAT class
00098     */
00099     Gamepad _bat_pad;
00100 
00101     /** boolean variable used in get_a_pressed() get_l_pressed() to check if button is pressed*/
00102     bool _button_pressed;
00103 };
00104 #endif