ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Committer:
shahidsajid
Date:
Wed May 08 12:13:28 2019 +0000
Revision:
31:eefa1d23a843
Parent:
30:43aace0fdbdf
Child:
32:1bc731f03a30
Documented and updated in-line comments for all the classes;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shahidsajid 21:a0904159e183 1 #ifndef UX_H
shahidsajid 21:a0904159e183 2 #define UX_H
shahidsajid 4:55a0509c4874 3
shahidsajid 4:55a0509c4874 4 #include "mbed.h"
shahidsajid 4:55a0509c4874 5 #include "N5110.h"
shahidsajid 4:55a0509c4874 6 #include "Gamepad.h"
shahidsajid 4:55a0509c4874 7
shahidsajid 26:6427f09cf8d3 8 /** Ball UX
shahidsajid 26:6427f09cf8d3 9 @author Shahid Zubin Sajid
shahidsajid 30:43aace0fdbdf 10 @brief Class for menus and display's user convenience
shahidsajid 31:eefa1d23a843 11 @date May 2019
shahidsajid 30:43aace0fdbdf 12 */
shahidsajid 31:eefa1d23a843 13
shahidsajid 21:a0904159e183 14 class UX
shahidsajid 4:55a0509c4874 15 {
shahidsajid 4:55a0509c4874 16
shahidsajid 4:55a0509c4874 17 public:
shahidsajid 31:eefa1d23a843 18 /**
shahidsajid 31:eefa1d23a843 19 * @brief Constructor for the Ball Class
shahidsajid 31:eefa1d23a843 20 */
shahidsajid 21:a0904159e183 21 UX();
shahidsajid 31:eefa1d23a843 22 /**
shahidsajid 31:eefa1d23a843 23 * @brief Deconstructor for the Ball Class
shahidsajid 31:eefa1d23a843 24 */
shahidsajid 21:a0904159e183 25 ~UX();
shahidsajid 30:43aace0fdbdf 26 /**
shahidsajid 26:6427f09cf8d3 27 * @brief Initlialises the UX class
shahidsajid 26:6427f09cf8d3 28 */
shahidsajid 21:a0904159e183 29 void init();
shahidsajid 30:43aace0fdbdf 30 /**
shahidsajid 26:6427f09cf8d3 31 * @brief checks if the Button A is pressed
shahidsajid 26:6427f09cf8d3 32 * @returns returns an int, 1 if the button is pressed 0 if false
shahidsajid 26:6427f09cf8d3 33 */
shahidsajid 21:a0904159e183 34 int get_a_pressed();
shahidsajid 30:43aace0fdbdf 35 /**
shahidsajid 26:6427f09cf8d3 36 * @brief checks if the Button L is pressed
shahidsajid 26:6427f09cf8d3 37 * @returns returns an int, 1 if the button is pressed 0 if false
shahidsajid 26:6427f09cf8d3 38 */
shahidsajid 30:43aace0fdbdf 39 int get_l_pressed();
shahidsajid 30:43aace0fdbdf 40 /**
shahidsajid 26:6427f09cf8d3 41 *@brief prints the introuction screen for the game
shahidsajid 26:6427f09cf8d3 42 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 43 */
shahidsajid 24:23fd6b451db7 44 void first_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 45 /**
shahidsajid 26:6427f09cf8d3 46 *@brief prints options menu and takes user input for which option they would like to choose
shahidsajid 26:6427f09cf8d3 47 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 48 */
shahidsajid 15:81a3aaf52647 49 void second_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 50 /**
shahidsajid 26:6427f09cf8d3 51 *@brief prints options menu and takes user input for which option they would like to choose
shahidsajid 26:6427f09cf8d3 52 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 53 */
shahidsajid 21:a0904159e183 54 void menu_options(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 55 /**
shahidsajid 26:6427f09cf8d3 56 *@brief prints the rules for the game across multiple displays
shahidsajid 26:6427f09cf8d3 57 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 58 */
shahidsajid 21:a0904159e183 59 void rules_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 60 /**
shahidsajid 26:6427f09cf8d3 61 *@brief prints the controls for the game across 3 displays
shahidsajid 26:6427f09cf8d3 62 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 63 */
shahidsajid 21:a0904159e183 64 void controls_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 65 /**
shahidsajid 26:6427f09cf8d3 66 *@brief prints the screen for when game is over
shahidsajid 26:6427f09cf8d3 67 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 68 *@param option @details option integer which denotes the manner in which the batsman was out
shahidsajid 26:6427f09cf8d3 69 */
shahidsajid 18:a260ce8db9e7 70 void game_over_menu(N5110 &menu_lcd,int option);
shahidsajid 30:43aace0fdbdf 71 /**
shahidsajid 26:6427f09cf8d3 72 *@brief prints the screen when player wins the game
shahidsajid 26:6427f09cf8d3 73 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 74 */
shahidsajid 18:a260ce8db9e7 75 void victory_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 76 /**
shahidsajid 30:43aace0fdbdf 77 *@brief Prints the rules for the game on the screen, called in rules_menu()
shahidsajid 30:43aace0fdbdf 78 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 30:43aace0fdbdf 79 */
shahidsajid 30:43aace0fdbdf 80 void rules_menu_game(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 81 /**
shahidsajid 30:43aace0fdbdf 82 *@brief Prints the rules for scoring runs during the game
shahidsajid 30:43aace0fdbdf 83 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 30:43aace0fdbdf 84 */
shahidsajid 30:43aace0fdbdf 85 void rules_menu_screen_out(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 86 /**
shahidsajid 30:43aace0fdbdf 87 *@brief Prints the rules for how a player can get out and lose the game
shahidsajid 30:43aace0fdbdf 88 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 30:43aace0fdbdf 89 */
shahidsajid 30:43aace0fdbdf 90 void rules_menu_screen_scoring_runs(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 91 /**
shahidsajid 30:43aace0fdbdf 92 * @brief resets the button_pressed boolean variable to false
shahidsajid 30:43aace0fdbdf 93 */
shahidsajid 30:43aace0fdbdf 94 void reset();
shahidsajid 30:43aace0fdbdf 95
shahidsajid 4:55a0509c4874 96 private:
shahidsajid 29:f7a2d2a755ec 97 /*Seperate Gamepad has been used in this class because Gamepad obect
shahidsajid 30:43aace0fdbdf 98 from the main class had issues with the CHECK_EVENT Function. The function was not responsive
shahidsajid 29:f7a2d2a755ec 99 and could not be resolved and as a result the only suitable solution was to create another object
shahidsajid 30:43aace0fdbdf 100 this explains why a ux object was passed in the Bat class to check if ball was hit or lofted as the
shahidsajid 29:f7a2d2a755ec 101 CHECK_EVENT was not responsive in the BAT class
shahidsajid 29:f7a2d2a755ec 102 */
shahidsajid 31:eefa1d23a843 103 Gamepad _bat_pad;
shahidsajid 30:43aace0fdbdf 104
shahidsajid 30:43aace0fdbdf 105 // boolean variable used in get_a_pressed() get_l_pressed() to check if button is pressed
shahidsajid 20:9d21599fe350 106 bool _button_pressed;
shahidsajid 4:55a0509c4874 107 };
shahidsajid 30:43aace0fdbdf 108 #endif