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.cpp@31:eefa1d23a843, 2019-05-08 (annotated)
- Committer:
- shahidsajid
- Date:
- Wed May 08 12:13:28 2019 +0000
- Revision:
- 31:eefa1d23a843
- Parent:
- 30:43aace0fdbdf
- Child:
- 33:9d34ef219fff
Documented and updated in-line comments for all the classes;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| shahidsajid | 21:a0904159e183 | 1 | #include "UX.h" |
| shahidsajid | 21:a0904159e183 | 2 | UX::UX() |
| shahidsajid | 4:55a0509c4874 | 3 | { |
| shahidsajid | 30:43aace0fdbdf | 4 | |
| shahidsajid | 4:55a0509c4874 | 5 | } |
| shahidsajid | 21:a0904159e183 | 6 | UX::~UX() |
| shahidsajid | 4:55a0509c4874 | 7 | { |
| shahidsajid | 30:43aace0fdbdf | 8 | |
| shahidsajid | 4:55a0509c4874 | 9 | } |
| shahidsajid | 30:43aace0fdbdf | 10 | //Initialises the UX Object |
| shahidsajid | 21:a0904159e183 | 11 | void UX::init() |
| shahidsajid | 30:43aace0fdbdf | 12 | { |
| shahidsajid | 31:eefa1d23a843 | 13 | _bat_pad.init(); |
| shahidsajid | 30:43aace0fdbdf | 14 | _button_pressed=false; |
| shahidsajid | 30:43aace0fdbdf | 15 | } |
| shahidsajid | 30:43aace0fdbdf | 16 | //Resets the button_pressed variable to ensure screen is printed again |
| shahidsajid | 30:43aace0fdbdf | 17 | void UX::reset(){ |
| shahidsajid | 20:9d21599fe350 | 18 | _button_pressed=false; |
| shahidsajid | 4:55a0509c4874 | 19 | } |
| shahidsajid | 30:43aace0fdbdf | 20 | /*Checks if A Button is pressed to indicate if the ball is hit during the gameplay*/ |
| shahidsajid | 21:a0904159e183 | 21 | int UX::get_a_pressed(){ |
| shahidsajid | 30:43aace0fdbdf | 22 | int _a_pressed=0; |
| shahidsajid | 31:eefa1d23a843 | 23 | if (_bat_pad.check_event(Gamepad::A_PRESSED) == true){ |
| shahidsajid | 30:43aace0fdbdf | 24 | _a_pressed=1; |
| shahidsajid | 30:43aace0fdbdf | 25 | } |
| shahidsajid | 30:43aace0fdbdf | 26 | return _a_pressed; |
| shahidsajid | 13:924891519a95 | 27 | } |
| shahidsajid | 30:43aace0fdbdf | 28 | /*Checks if L Button is pressed to indicate if the ball hit is lofted during the gameplay*/ |
| shahidsajid | 21:a0904159e183 | 29 | int UX::get_l_pressed(){ |
| shahidsajid | 30:43aace0fdbdf | 30 | int _l_pressed=0; |
| shahidsajid | 31:eefa1d23a843 | 31 | if (_bat_pad.check_event(Gamepad::L_PRESSED) == true){ |
| shahidsajid | 30:43aace0fdbdf | 32 | _l_pressed=1; |
| shahidsajid | 30:43aace0fdbdf | 33 | } |
| shahidsajid | 30:43aace0fdbdf | 34 | return _l_pressed; |
| shahidsajid | 6:3e50f2cf4366 | 35 | } |
| shahidsajid | 30:43aace0fdbdf | 36 | /*prints the first screen labeling the game name and my student ID*/ |
| shahidsajid | 24:23fd6b451db7 | 37 | void UX::first_menu(N5110 &menu_lcd){ |
| shahidsajid | 30:43aace0fdbdf | 38 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 39 | menu_lcd.printString("HERO CRICKET",5,1); |
| shahidsajid | 30:43aace0fdbdf | 40 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 41 | menu_lcd.printString(" A Game By",5,2); |
| shahidsajid | 30:43aace0fdbdf | 42 | menu_lcd.printString( " el17szs",5,3); |
| shahidsajid | 30:43aace0fdbdf | 43 | wait(1); |
| shahidsajid | 30:43aace0fdbdf | 44 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 45 | menu_lcd.printString("PRESS START..",1,5); |
| shahidsajid | 30:43aace0fdbdf | 46 | wait(1); |
| shahidsajid | 30:43aace0fdbdf | 47 | menu_lcd.refresh(); |
| shahidsajid | 31:eefa1d23a843 | 48 | while (_bat_pad.check_event(Gamepad::START_PRESSED) == false) { |
| shahidsajid | 30:43aace0fdbdf | 49 | printf("2"); |
| shahidsajid | 31:eefa1d23a843 | 50 | _bat_pad.leds_on(); |
| shahidsajid | 30:43aace0fdbdf | 51 | wait(0.1); |
| shahidsajid | 31:eefa1d23a843 | 52 | _bat_pad.leds_off(); |
| shahidsajid | 30:43aace0fdbdf | 53 | wait(0.1); |
| shahidsajid | 30:43aace0fdbdf | 54 | } |
| shahidsajid | 30:43aace0fdbdf | 55 | second_menu(menu_lcd); |
| shahidsajid | 31:eefa1d23a843 | 56 | _bat_pad.leds_off(); |
| shahidsajid | 15:81a3aaf52647 | 57 | } |
| shahidsajid | 30:43aace0fdbdf | 58 | /* |
| shahidsajid | 30:43aace0fdbdf | 59 | The second menu is called at the start of the game and each time a game is over |
| shahidsajid | 30:43aace0fdbdf | 60 | The menu gives the user an option to choose between playing the game |
| shahidsajid | 30:43aace0fdbdf | 61 | reading the controls or the rules of the game |
| shahidsajid | 30:43aace0fdbdf | 62 | */ |
| shahidsajid | 21:a0904159e183 | 63 | void UX::second_menu(N5110 &menu_lcd){ |
| shahidsajid | 30:43aace0fdbdf | 64 | menu_lcd.setContrast(0.5); |
| shahidsajid | 30:43aace0fdbdf | 65 | while (_button_pressed==false){ |
| shahidsajid | 30:43aace0fdbdf | 66 | menu_options(menu_lcd); |
| shahidsajid | 31:eefa1d23a843 | 67 | if (_bat_pad.check_event(Gamepad::A_PRESSED) == true){ |
| shahidsajid | 30:43aace0fdbdf | 68 | _button_pressed=true; |
| shahidsajid | 21:a0904159e183 | 69 | } |
| shahidsajid | 31:eefa1d23a843 | 70 | if (_bat_pad.check_event(Gamepad::B_PRESSED) == true){ |
| shahidsajid | 30:43aace0fdbdf | 71 | rules_menu(menu_lcd); |
| shahidsajid | 30:43aace0fdbdf | 72 | } |
| shahidsajid | 31:eefa1d23a843 | 73 | if (_bat_pad.check_event(Gamepad::X_PRESSED) == true){ |
| shahidsajid | 30:43aace0fdbdf | 74 | controls_menu(menu_lcd); |
| shahidsajid | 30:43aace0fdbdf | 75 | } |
| shahidsajid | 30:43aace0fdbdf | 76 | } |
| shahidsajid | 21:a0904159e183 | 77 | } |
| shahidsajid | 30:43aace0fdbdf | 78 | /*Prints the options for the second menu onto the screen */ |
| shahidsajid | 21:a0904159e183 | 79 | void UX::menu_options(N5110 &menu_lcd){ |
| shahidsajid | 31:eefa1d23a843 | 80 | _bat_pad.leds_off(); |
| shahidsajid | 30:43aace0fdbdf | 81 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 82 | menu_lcd.setContrast(0.5); |
| shahidsajid | 30:43aace0fdbdf | 83 | menu_lcd.drawRect(0,0,WIDTH,HEIGHT,FILL_TRANSPARENT); |
| shahidsajid | 30:43aace0fdbdf | 84 | menu_lcd.printString("START GAME",2,1); |
| shahidsajid | 30:43aace0fdbdf | 85 | menu_lcd.printString("A",70,1); |
| shahidsajid | 30:43aace0fdbdf | 86 | menu_lcd.drawCircle(72,11,5,FILL_TRANSPARENT); |
| shahidsajid | 30:43aace0fdbdf | 87 | menu_lcd.printString("RULES",2,3); |
| shahidsajid | 30:43aace0fdbdf | 88 | menu_lcd.printString("B",70,3); |
| shahidsajid | 30:43aace0fdbdf | 89 | menu_lcd.drawCircle(72,27,5,FILL_TRANSPARENT); |
| shahidsajid | 30:43aace0fdbdf | 90 | menu_lcd.printString("CONTROLS",2,5); |
| shahidsajid | 30:43aace0fdbdf | 91 | menu_lcd.printString("X",70,5); |
| shahidsajid | 30:43aace0fdbdf | 92 | menu_lcd.drawCircle(72,42,5,FILL_TRANSPARENT); |
| shahidsajid | 30:43aace0fdbdf | 93 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 94 | } |
| shahidsajid | 30:43aace0fdbdf | 95 | /*Prints the rules of the game to the LCD for user experience |
| shahidsajid | 30:43aace0fdbdf | 96 | There is wait of 5 seconds betwen each screen for the user to read the rules |
| shahidsajid | 30:43aace0fdbdf | 97 | */ |
| shahidsajid | 30:43aace0fdbdf | 98 | void UX::rules_menu(N5110 &menu_lcd){ |
| shahidsajid | 30:43aace0fdbdf | 99 | rules_menu_game(menu_lcd); |
| shahidsajid | 30:43aace0fdbdf | 100 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 101 | rules_menu_screen_scoring_runs(menu_lcd); |
| shahidsajid | 30:43aace0fdbdf | 102 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 103 | rules_menu_screen_out(menu_lcd); |
| shahidsajid | 30:43aace0fdbdf | 104 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 105 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 106 | menu_lcd.printString("The target is",0,0); |
| shahidsajid | 30:43aace0fdbdf | 107 | menu_lcd.printString("printed bottom ",0,1); |
| shahidsajid | 30:43aace0fdbdf | 108 | menu_lcd.printString("left of LCD",0,2); |
| shahidsajid | 30:43aace0fdbdf | 109 | menu_lcd.printString("Balls and Runs",0,3); |
| shahidsajid | 31:eefa1d23a843 | 110 | menu_lcd.printString("on top Right",0,4); |
| shahidsajid | 31:eefa1d23a843 | 111 | menu_lcd.printString("and Left",0,5); |
| shahidsajid | 30:43aace0fdbdf | 112 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 113 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 114 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 115 | menu_lcd.printString("10 balls are",0,1); |
| shahidsajid | 30:43aace0fdbdf | 116 | menu_lcd.printString("given to score",0,2); |
| shahidsajid | 30:43aace0fdbdf | 117 | menu_lcd.printString("a set target",0,3); |
| shahidsajid | 30:43aace0fdbdf | 118 | menu_lcd.printString("GOOD LUCK!!!",0,4); |
| shahidsajid | 30:43aace0fdbdf | 119 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 120 | wait(5); |
| shahidsajid | 15:81a3aaf52647 | 121 | } |
| shahidsajid | 30:43aace0fdbdf | 122 | /*Prints the rules for the game on the screen, called in rules_menu()*/ |
| shahidsajid | 30:43aace0fdbdf | 123 | void UX::rules_menu_game(N5110 &menu_lcd){ |
| shahidsajid | 30:43aace0fdbdf | 124 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 125 | menu_lcd.setContrast(0.5); |
| shahidsajid | 30:43aace0fdbdf | 126 | menu_lcd.printString("Hit the ball",0,0); |
| shahidsajid | 30:43aace0fdbdf | 127 | menu_lcd.printString("to score runs",0,1); |
| shahidsajid | 31:eefa1d23a843 | 128 | menu_lcd.printString("Ball is bowled",0,3); |
| shahidsajid | 30:43aace0fdbdf | 129 | menu_lcd.printString("with a tone",0,4); |
| shahidsajid | 30:43aace0fdbdf | 130 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 131 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 132 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 133 | menu_lcd.setContrast(0.5); |
| shahidsajid | 30:43aace0fdbdf | 134 | menu_lcd.printString("There are 5",0,0); |
| shahidsajid | 30:43aace0fdbdf | 135 | menu_lcd.printString("fielders in",0,1); |
| shahidsajid | 31:eefa1d23a843 | 136 | menu_lcd.printString("the outfield ",0,2); |
| shahidsajid | 30:43aace0fdbdf | 137 | menu_lcd.printString("marked by",0,3); |
| shahidsajid | 30:43aace0fdbdf | 138 | menu_lcd.printString("white circles",0,4); |
| shahidsajid | 30:43aace0fdbdf | 139 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 140 | } |
| shahidsajid | 30:43aace0fdbdf | 141 | /*Prints the rules for scoring runs during the game*/ |
| shahidsajid | 30:43aace0fdbdf | 142 | void UX::rules_menu_screen_scoring_runs(N5110 &menu_lcd){ |
| shahidsajid | 30:43aace0fdbdf | 143 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 144 | menu_lcd.setContrast(0.5); |
| shahidsajid | 30:43aace0fdbdf | 145 | menu_lcd.printString("SCORING RUNS",0,0); |
| shahidsajid | 30:43aace0fdbdf | 146 | menu_lcd.printString("Lofted Hit:",0,2); |
| shahidsajid | 30:43aace0fdbdf | 147 | menu_lcd.printString("Hit In between ",0,3); |
| shahidsajid | 30:43aace0fdbdf | 148 | menu_lcd.printString("the fielders ",0,4); |
| shahidsajid | 30:43aace0fdbdf | 149 | menu_lcd.printString("is 6 runs",0,5); |
| shahidsajid | 30:43aace0fdbdf | 150 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 151 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 152 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 153 | menu_lcd.setContrast(0.5); |
| shahidsajid | 30:43aace0fdbdf | 154 | menu_lcd.printString("SCORING RUNS",0,0); |
| shahidsajid | 30:43aace0fdbdf | 155 | menu_lcd.printString("Normal Hit:",0,2); |
| shahidsajid | 30:43aace0fdbdf | 156 | menu_lcd.printString("Hit In between ",0,3); |
| shahidsajid | 30:43aace0fdbdf | 157 | menu_lcd.printString("the fielders ",0,4); |
| shahidsajid | 30:43aace0fdbdf | 158 | menu_lcd.printString("is 4 runs",0,5); |
| shahidsajid | 30:43aace0fdbdf | 159 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 160 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 161 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 162 | menu_lcd.setContrast(0.5); |
| shahidsajid | 30:43aace0fdbdf | 163 | menu_lcd.printString("SCORING RUNS",0,0); |
| shahidsajid | 30:43aace0fdbdf | 164 | menu_lcd.printString("Normal Hit:",0,2); |
| shahidsajid | 30:43aace0fdbdf | 165 | menu_lcd.printString("Hit to fielder ",0,3); |
| shahidsajid | 30:43aace0fdbdf | 166 | menu_lcd.printString("inside circle ",0,4); |
| shahidsajid | 30:43aace0fdbdf | 167 | menu_lcd.printString("is 1 run",0,5); |
| shahidsajid | 30:43aace0fdbdf | 168 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 169 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 170 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 171 | menu_lcd.printString("SCORING RUNS",0,0); |
| shahidsajid | 30:43aace0fdbdf | 172 | menu_lcd.printString("Normal Hit:",0,2); |
| shahidsajid | 30:43aace0fdbdf | 173 | menu_lcd.printString("Hit to fielder ",0,3); |
| shahidsajid | 30:43aace0fdbdf | 174 | menu_lcd.printString("out of circle ",0,4); |
| shahidsajid | 30:43aace0fdbdf | 175 | menu_lcd.printString("is 2 runs",0,5); |
| shahidsajid | 30:43aace0fdbdf | 176 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 177 | } |
| shahidsajid | 30:43aace0fdbdf | 178 | /*Prints the rules for how a player can get out and lose the game */ |
| shahidsajid | 30:43aace0fdbdf | 179 | void UX::rules_menu_screen_out(N5110 &menu_lcd){ |
| shahidsajid | 21:a0904159e183 | 180 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 181 | menu_lcd.printString("GETTING OUT",0,0); |
| shahidsajid | 30:43aace0fdbdf | 182 | menu_lcd.printString("CAUGHT:",0,2); |
| shahidsajid | 30:43aace0fdbdf | 183 | menu_lcd.printString("A Lofted Hit",0,3); |
| shahidsajid | 30:43aace0fdbdf | 184 | menu_lcd.printString("to a fiedler",0,4); |
| shahidsajid | 30:43aace0fdbdf | 185 | menu_lcd.printString("is OUT",0,5); |
| shahidsajid | 30:43aace0fdbdf | 186 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 187 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 188 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 189 | menu_lcd.printString("GETTING OUT",0,0); |
| shahidsajid | 30:43aace0fdbdf | 190 | menu_lcd.printString("BOWLED:",0,2); |
| shahidsajid | 30:43aace0fdbdf | 191 | menu_lcd.printString("If you do ",0,3); |
| shahidsajid | 30:43aace0fdbdf | 192 | menu_lcd.printString("not hit ball",0,4); |
| shahidsajid | 30:43aace0fdbdf | 193 | menu_lcd.printString("It is OUT",0,5); |
| shahidsajid | 30:43aace0fdbdf | 194 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 195 | } |
| shahidsajid | 30:43aace0fdbdf | 196 | /*Prints the controls for the game to the LCD for user experience |
| shahidsajid | 30:43aace0fdbdf | 197 | There is wait of 5 seconds betwen each screen for the user to read the controls |
| shahidsajid | 30:43aace0fdbdf | 198 | */ |
| shahidsajid | 21:a0904159e183 | 199 | void UX::controls_menu(N5110 &menu_lcd){ |
| shahidsajid | 30:43aace0fdbdf | 200 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 201 | menu_lcd.printString("Hold down A to ",0,2); |
| shahidsajid | 30:43aace0fdbdf | 202 | menu_lcd.printString("hit the ball",0,3); |
| shahidsajid | 30:43aace0fdbdf | 203 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 204 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 205 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 206 | menu_lcd.printString("Hold down A ",0,1); |
| shahidsajid | 30:43aace0fdbdf | 207 | menu_lcd.printString("and L for ",0,2); |
| shahidsajid | 30:43aace0fdbdf | 208 | menu_lcd.printString("a lofted hit",0,3); |
| shahidsajid | 30:43aace0fdbdf | 209 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 210 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 211 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 212 | menu_lcd.printString("Move joystick to",0,1); |
| shahidsajid | 30:43aace0fdbdf | 213 | menu_lcd.printString("the direction",0,2); |
| shahidsajid | 30:43aace0fdbdf | 214 | menu_lcd.printString("you want to",0,3); |
| shahidsajid | 30:43aace0fdbdf | 215 | menu_lcd.printString("hit the ball",0,4); |
| shahidsajid | 30:43aace0fdbdf | 216 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 217 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 218 | } |
| shahidsajid | 30:43aace0fdbdf | 219 | /*Prints messages to the screen to inform user that game is over |
| shahidsajid | 30:43aace0fdbdf | 220 | There are 3 ways for the game to end with the argument integer indicating the afformentoned. |
| shahidsajid | 30:43aace0fdbdf | 221 | The 3 ways for the game to end are |
| shahidsajid | 30:43aace0fdbdf | 222 | 1. No more balls remaning |
| shahidsajid | 30:43aace0fdbdf | 223 | 2. Player did not hit the ball: BOWLED |
| shahidsajid | 30:43aace0fdbdf | 224 | 3. Player hit a lofted shot to a fielder : CAUGHT |
| shahidsajid | 30:43aace0fdbdf | 225 | */ |
| shahidsajid | 30:43aace0fdbdf | 226 | void UX::game_over_menu(N5110 &menu_lcd,int option){ |
| shahidsajid | 30:43aace0fdbdf | 227 | if (option==1){ |
| shahidsajid | 21:a0904159e183 | 228 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 229 | menu_lcd.printString("GAME LOST",2,1); |
| shahidsajid | 30:43aace0fdbdf | 230 | menu_lcd.printString("NO MORE BALLS LEFT",2,3); |
| shahidsajid | 21:a0904159e183 | 231 | menu_lcd.refresh(); |
| shahidsajid | 21:a0904159e183 | 232 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 233 | } |
| shahidsajid | 30:43aace0fdbdf | 234 | if (option==2){ |
| shahidsajid | 21:a0904159e183 | 235 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 236 | menu_lcd.printString("GAME LOST",2,1); |
| shahidsajid | 30:43aace0fdbdf | 237 | menu_lcd.printString("BOWLED",2,3); |
| shahidsajid | 21:a0904159e183 | 238 | menu_lcd.refresh(); |
| shahidsajid | 21:a0904159e183 | 239 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 240 | } |
| shahidsajid | 30:43aace0fdbdf | 241 | if (option==3){ |
| shahidsajid | 21:a0904159e183 | 242 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 243 | menu_lcd.printString("GAME LOST",2,1); |
| shahidsajid | 30:43aace0fdbdf | 244 | menu_lcd.printString("CAUGHT",2,3); |
| shahidsajid | 21:a0904159e183 | 245 | menu_lcd.refresh(); |
| shahidsajid | 21:a0904159e183 | 246 | wait(5); |
| shahidsajid | 30:43aace0fdbdf | 247 | } |
| shahidsajid | 18:a260ce8db9e7 | 248 | } |
| shahidsajid | 30:43aace0fdbdf | 249 | /*Prints messages to the LCD to inform user that the game is won*/ |
| shahidsajid | 21:a0904159e183 | 250 | void UX::victory_menu(N5110 &menu_lcd){ |
| shahidsajid | 30:43aace0fdbdf | 251 | menu_lcd.clear(); |
| shahidsajid | 30:43aace0fdbdf | 252 | menu_lcd.printString("CONGRATS!!",2,1); |
| shahidsajid | 30:43aace0fdbdf | 253 | menu_lcd.printString("YOU HAVE WON",2,3); |
| shahidsajid | 30:43aace0fdbdf | 254 | menu_lcd.refresh(); |
| shahidsajid | 30:43aace0fdbdf | 255 | wait(5); |
| shahidsajid | 18:a260ce8db9e7 | 256 | } |