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@26:6427f09cf8d3, 2019-05-01 (annotated)
- Committer:
- shahidsajid
- Date:
- Wed May 01 11:56:36 2019 +0000
- Revision:
- 26:6427f09cf8d3
- Parent:
- 24:23fd6b451db7
- Child:
- 28:d0b0a64a832d
Documented the UX 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 | 14:122eaa3b7a50 | 72 | |
| shahidsajid | 6:3e50f2cf4366 | 73 | Gamepad batPad; |
| shahidsajid | 26:6427f09cf8d3 | 74 | // boolean variable used in get_a_pressed() get_l_pressed() to check if button is pressed |
| shahidsajid | 20:9d21599fe350 | 75 | bool _button_pressed; |
| shahidsajid | 4:55a0509c4874 | 76 | }; |
| shahidsajid | 4:55a0509c4874 | 77 | #endif |