ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Committer:
shahidsajid
Date:
Wed May 08 01:20:06 2019 +0000
Revision:
30:43aace0fdbdf
Parent:
29:f7a2d2a755ec
Child:
31:eefa1d23a843
Updated in-line comments for 3 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 4:55a0509c4874 11 @date Febraury 2017
shahidsajid 30:43aace0fdbdf 12 */
shahidsajid 21:a0904159e183 13 class UX
shahidsajid 4:55a0509c4874 14 {
shahidsajid 4:55a0509c4874 15
shahidsajid 4:55a0509c4874 16 public:
shahidsajid 21:a0904159e183 17 UX();
shahidsajid 21:a0904159e183 18 ~UX();
shahidsajid 30:43aace0fdbdf 19 /**
shahidsajid 26:6427f09cf8d3 20 * @brief Initlialises the UX class
shahidsajid 26:6427f09cf8d3 21 */
shahidsajid 21:a0904159e183 22 void init();
shahidsajid 30:43aace0fdbdf 23 /**
shahidsajid 26:6427f09cf8d3 24 * @brief checks if the Button A is pressed
shahidsajid 26:6427f09cf8d3 25 * @returns returns an int, 1 if the button is pressed 0 if false
shahidsajid 26:6427f09cf8d3 26 */
shahidsajid 21:a0904159e183 27 int get_a_pressed();
shahidsajid 30:43aace0fdbdf 28 /**
shahidsajid 26:6427f09cf8d3 29 * @brief checks if the Button L is pressed
shahidsajid 26:6427f09cf8d3 30 * @returns returns an int, 1 if the button is pressed 0 if false
shahidsajid 26:6427f09cf8d3 31 */
shahidsajid 30:43aace0fdbdf 32 int get_l_pressed();
shahidsajid 30:43aace0fdbdf 33 /**
shahidsajid 26:6427f09cf8d3 34 *@brief prints the introuction screen for the game
shahidsajid 26:6427f09cf8d3 35 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 36 */
shahidsajid 24:23fd6b451db7 37 void first_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 38 /**
shahidsajid 26:6427f09cf8d3 39 *@brief prints options menu and takes user input for which option they would like to choose
shahidsajid 26:6427f09cf8d3 40 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 41 */
shahidsajid 15:81a3aaf52647 42 void second_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 43 /**
shahidsajid 26:6427f09cf8d3 44 *@brief prints options menu and takes user input for which option they would like to choose
shahidsajid 26:6427f09cf8d3 45 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 46 */
shahidsajid 21:a0904159e183 47 void menu_options(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 48 /**
shahidsajid 26:6427f09cf8d3 49 *@brief prints the rules for the game across multiple displays
shahidsajid 26:6427f09cf8d3 50 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 51 */
shahidsajid 21:a0904159e183 52 void rules_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 53 /**
shahidsajid 26:6427f09cf8d3 54 *@brief prints the controls for the game across 3 displays
shahidsajid 26:6427f09cf8d3 55 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 56 */
shahidsajid 21:a0904159e183 57 void controls_menu(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 58 /**
shahidsajid 26:6427f09cf8d3 59 *@brief prints the screen for when game is over
shahidsajid 26:6427f09cf8d3 60 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 61 *@param option @details option integer which denotes the manner in which the batsman was out
shahidsajid 26:6427f09cf8d3 62 */
shahidsajid 18:a260ce8db9e7 63 void game_over_menu(N5110 &menu_lcd,int option);
shahidsajid 30:43aace0fdbdf 64 /**
shahidsajid 26:6427f09cf8d3 65 *@brief prints the screen when player wins the game
shahidsajid 26:6427f09cf8d3 66 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 26:6427f09cf8d3 67 */
shahidsajid 18:a260ce8db9e7 68 void victory_menu(N5110 &menu_lcd);
shahidsajid 18:a260ce8db9e7 69 void info_screen(N5110 &menu_lcd, int target);
shahidsajid 30:43aace0fdbdf 70 /**
shahidsajid 30:43aace0fdbdf 71 *@brief Prints the rules for the game on the screen, called in rules_menu()
shahidsajid 30:43aace0fdbdf 72 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 30:43aace0fdbdf 73 */
shahidsajid 30:43aace0fdbdf 74 void rules_menu_game(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 75 /**
shahidsajid 30:43aace0fdbdf 76 *@brief Prints the rules for scoring runs during the game
shahidsajid 30:43aace0fdbdf 77 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 30:43aace0fdbdf 78 */
shahidsajid 30:43aace0fdbdf 79 void rules_menu_screen_out(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 80 /**
shahidsajid 30:43aace0fdbdf 81 *@brief Prints the rules for how a player can get out and lose the game
shahidsajid 30:43aace0fdbdf 82 *@param &menu_lcd @details reference object for a N5110 class object
shahidsajid 30:43aace0fdbdf 83 */
shahidsajid 30:43aace0fdbdf 84 void rules_menu_screen_scoring_runs(N5110 &menu_lcd);
shahidsajid 30:43aace0fdbdf 85 /**
shahidsajid 30:43aace0fdbdf 86 * @brief resets the button_pressed boolean variable to false
shahidsajid 30:43aace0fdbdf 87 */
shahidsajid 30:43aace0fdbdf 88 void reset();
shahidsajid 30:43aace0fdbdf 89
shahidsajid 4:55a0509c4874 90 private:
shahidsajid 29:f7a2d2a755ec 91 /*Seperate Gamepad has been used in this class because Gamepad obect
shahidsajid 30:43aace0fdbdf 92 from the main class had issues with the CHECK_EVENT Function. The function was not responsive
shahidsajid 29:f7a2d2a755ec 93 and could not be resolved and as a result the only suitable solution was to create another object
shahidsajid 30:43aace0fdbdf 94 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 95 CHECK_EVENT was not responsive in the BAT class
shahidsajid 29:f7a2d2a755ec 96 */
shahidsajid 6:3e50f2cf4366 97 Gamepad batPad;
shahidsajid 30:43aace0fdbdf 98
shahidsajid 30:43aace0fdbdf 99 // boolean variable used in get_a_pressed() get_l_pressed() to check if button is pressed
shahidsajid 20:9d21599fe350 100 bool _button_pressed;
shahidsajid 4:55a0509c4874 101 };
shahidsajid 30:43aace0fdbdf 102 #endif