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@29:f7a2d2a755ec, 2019-05-07 (annotated)
- Committer:
- shahidsajid
- Date:
- Tue May 07 18:38:54 2019 +0000
- Revision:
- 29:f7a2d2a755ec
- Parent:
- 28:d0b0a64a832d
- Child:
- 30:43aace0fdbdf
Completed documenting the Cricket class;
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 | 26:6427f09cf8d3 | 8 | /** Ball UX |
| shahidsajid | 26:6427f09cf8d3 | 9 | @author Shahid Zubin Sajid |
| shahidsajid | 26:6427f09cf8d3 | 10 | @brief Class for menus and display's user convenience |
| shahidsajid | 4:55a0509c4874 | 11 | @date Febraury 2017 |
| shahidsajid | 4:55a0509c4874 | 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 | 26:6427f09cf8d3 | 19 | /** |
| shahidsajid | 26:6427f09cf8d3 | 20 | * @brief Initlialises the UX class |
| shahidsajid | 26:6427f09cf8d3 | 21 | */ |
| shahidsajid | 21:a0904159e183 | 22 | void init(); |
| shahidsajid | 26:6427f09cf8d3 | 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 | 26:6427f09cf8d3 | 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 | 26:6427f09cf8d3 | 32 | int get_l_pressed(); |
| shahidsajid | 26:6427f09cf8d3 | 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 | 26:6427f09cf8d3 | 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 | 26:6427f09cf8d3 | 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 | 26:6427f09cf8d3 | 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 | 26:6427f09cf8d3 | 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 | 26:6427f09cf8d3 | 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 | 26:6427f09cf8d3 | 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 | 4:55a0509c4874 | 70 | |
| shahidsajid | 4:55a0509c4874 | 71 | private: |
| shahidsajid | 29:f7a2d2a755ec | 72 | /*Seperate Gamepad has been used in this class because Gamepad obect |
| shahidsajid | 29:f7a2d2a755ec | 73 | f rom the main class had issues with the CHECK_EVENT Function. The function was not responsive |
| shahidsajid | 29:f7a2d2a755ec | 74 | and could not be resolved and as a result the only suitable solution was to create another object |
| shahidsajid | 29:f7a2d2a755ec | 75 | 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 | 76 | CHECK_EVENT was not responsive in the BAT class |
| shahidsajid | 29:f7a2d2a755ec | 77 | */ |
| shahidsajid | 6:3e50f2cf4366 | 78 | Gamepad batPad; |
| shahidsajid | 28:d0b0a64a832d | 79 | |
| shahidsajid | 26:6427f09cf8d3 | 80 | // boolean variable used in get_a_pressed() get_l_pressed() to check if button is pressed |
| shahidsajid | 20:9d21599fe350 | 81 | bool _button_pressed; |
| shahidsajid | 4:55a0509c4874 | 82 | }; |
| shahidsajid | 4:55a0509c4874 | 83 | #endif |