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