![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
MenuClasses/StartScreen/StartScreen.cpp@55:df0825049171, 2019-04-27 (annotated)
- Committer:
- AhmedPlaymaker
- Date:
- Sat Apr 27 18:56:30 2019 +0000
- Revision:
- 55:df0825049171
- Parent:
- 52:c2faa96cf293
- Child:
- 56:142e9fdb77a8
Converted menus from if implementation to case structures
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AhmedPlaymaker | 3:fbb1fa853f09 | 1 | #include "StartScreen.h" |
AhmedPlaymaker | 5:e4df87957a5b | 2 | Settings settings; |
AhmedPlaymaker | 3:fbb1fa853f09 | 3 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 4 | int sprite[48][84] = { |
AhmedPlaymaker | 6:3ffab44ed49c | 5 | {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 6 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 7 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 6: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aymaker | 6:3ffab44ed49c | 49 | {1,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,0,0,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 50 | {1,0,0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,0,0,0,1,1,1,1,0,1,1,0,0,1,1,0,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 51 | {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, |
AhmedPlaymaker | 6:3ffab44ed49c | 52 | {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 53 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 54 | }; |
AhmedPlaymaker | 3:fbb1fa853f09 | 55 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 56 | int arrow[7][9] = { |
AhmedPlaymaker | 3:fbb1fa853f09 | 57 | {0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 58 | {0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 59 | {0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 60 | {0,1,1,1,1,1,1,1,1}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 61 | {0,0,1,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 62 | {0,0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 3:fbb1fa853f09 | 63 | {0,0,0,0,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 64 | }; |
AhmedPlaymaker | 4:1fe015b66bb8 | 65 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 66 | int bullet[13][5] = { |
AhmedPlaymaker | 4:1fe015b66bb8 | 67 | {1,0,0,0,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 68 | {1,0,0,0,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 69 | {0,1,0,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 70 | {0,0,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 71 | {0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 72 | {0,0,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 73 | {0,0,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 74 | {0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 75 | {0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 76 | {0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 77 | {0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 78 | {0,0,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 79 | {0,0,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 80 | }; |
AhmedPlaymaker | 4:1fe015b66bb8 | 81 | int navL[13][8] = { |
AhmedPlaymaker | 4:1fe015b66bb8 | 82 | {0,0,0,0,0,0,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 83 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 84 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 85 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 86 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 87 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 88 | {1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 89 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 90 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 91 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 92 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 93 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 94 | {0,0,0,0,0,0,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 95 | }; |
AhmedPlaymaker | 3:fbb1fa853f09 | 96 | |
AhmedPlaymaker | 4:1fe015b66bb8 | 97 | int navR[13][8] = { |
AhmedPlaymaker | 4:1fe015b66bb8 | 98 | {1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 99 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 100 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 101 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 102 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 103 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 104 | {0,0,0,0,0,0,1,1}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 105 | {0,0,0,0,0,1,1,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 106 | {0,0,0,0,1,1,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 107 | {0,0,0,1,1,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 108 | {0,0,1,1,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 109 | {0,1,1,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 110 | {1,1,0,0,0,0,0,0}, |
AhmedPlaymaker | 4:1fe015b66bb8 | 111 | }; |
AhmedPlaymaker | 16:7b474f873683 | 112 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 113 | StartScreen::StartScreen() |
AhmedPlaymaker | 3:fbb1fa853f09 | 114 | { |
AhmedPlaymaker | 3:fbb1fa853f09 | 115 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 116 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 117 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 118 | StartScreen::~StartScreen() |
AhmedPlaymaker | 3:fbb1fa853f09 | 119 | { |
AhmedPlaymaker | 3:fbb1fa853f09 | 120 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 121 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 122 | |
AhmedPlaymaker | 30:461231877c89 | 123 | void StartScreen::init() |
AhmedPlaymaker | 30:461231877c89 | 124 | { |
AhmedPlaymaker | 36:dfdd619874ae | 125 | i = 16; //main menu selection arrow position |
AhmedPlaymaker | 36:dfdd619874ae | 126 | lr = 1; //game mode page selection. |
AhmedPlaymaker | 47:b448ffd073e7 | 127 | gs = 2; //game speed page selection. |
AhmedPlaymaker | 36:dfdd619874ae | 128 | st = 1; //this is the sr num of settings pages. |
AhmedPlaymaker | 36:dfdd619874ae | 129 | sc = 1; //this helps in wether ot not to show credits to the user. |
AhmedPlaymaker | 36:dfdd619874ae | 130 | cs = 4; //sensitivity of control speed of menu options. |
AhmedPlaymaker | 30:461231877c89 | 131 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 132 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 133 | void StartScreen::screen_saver(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 134 | { |
AhmedPlaymaker | 28:d2c621d67e3b | 135 | //this saves the Theme song I want to play at the start. |
AhmedPlaymaker | 26:3495f7b0ede7 | 136 | int song[18] = {441,494,439,372,392,370,330,246,329,331,370,555,555,495,440,392,392,370}; |
AhmedPlaymaker | 6:3ffab44ed49c | 137 | pad.leds_on(); |
AhmedPlaymaker | 26:3495f7b0ede7 | 138 | |
AhmedPlaymaker | 28:d2c621d67e3b | 139 | for(int ani = -51; ani <= 0; ani+=3) { |
AhmedPlaymaker | 26:3495f7b0ede7 | 140 | lcd.clear(); |
AhmedPlaymaker | 26:3495f7b0ede7 | 141 | lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite |
AhmedPlaymaker | 26:3495f7b0ede7 | 142 | lcd.refresh(); |
AhmedPlaymaker | 26:3495f7b0ede7 | 143 | pad.tone(song[(ani+48)/3],0.1); |
AhmedPlaymaker | 26:3495f7b0ede7 | 144 | wait(0.2); |
AhmedPlaymaker | 26:3495f7b0ede7 | 145 | } |
AhmedPlaymaker | 26:3495f7b0ede7 | 146 | |
AhmedPlaymaker | 16:7b474f873683 | 147 | wait(0.3); |
AhmedPlaymaker | 3:fbb1fa853f09 | 148 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 149 | lcd.clear(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 150 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 151 | |
AhmedPlaymaker | 3:fbb1fa853f09 | 152 | void StartScreen::instruct(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 153 | { |
AhmedPlaymaker | 3:fbb1fa853f09 | 154 | lcd.printString("Please Press",5,1); //Function used to promt the user to start. |
AhmedPlaymaker | 3:fbb1fa853f09 | 155 | lcd.printString("Start",25,3); |
AhmedPlaymaker | 3:fbb1fa853f09 | 156 | lcd.printString("to Begin",15,5); |
AhmedPlaymaker | 3:fbb1fa853f09 | 157 | lcd.refresh(); |
AhmedPlaymaker | 30:461231877c89 | 158 | pad.init(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 159 | while ( pad.check_event(Gamepad::START_PRESSED) == false) { |
AhmedPlaymaker | 3:fbb1fa853f09 | 160 | pad.leds_on(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 161 | wait(0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 162 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 163 | wait(0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 164 | } |
AhmedPlaymaker | 6:3ffab44ed49c | 165 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 3:fbb1fa853f09 | 166 | lcd.clear(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 167 | pad.leds_off(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 168 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 169 | |
AhmedPlaymaker | 49:441c32f6603e | 170 | void StartScreen::credits(N5110 &lcd) |
AhmedPlaymaker | 3:fbb1fa853f09 | 171 | { |
AhmedPlaymaker | 49:441c32f6603e | 172 | lcd.clear(); |
AhmedPlaymaker | 49:441c32f6603e | 173 | if(sc) { |
AhmedPlaymaker | 5:e4df87957a5b | 174 | lcd.printString("Created BY",8,1); |
AhmedPlaymaker | 5:e4df87957a5b | 175 | lcd.printString("Ahmed",24,3); |
AhmedPlaymaker | 5:e4df87957a5b | 176 | lcd.printString("Adamjee",20,4); |
AhmedPlaymaker | 5:e4df87957a5b | 177 | lcd.printString("201161436",15,5); |
AhmedPlaymaker | 5:e4df87957a5b | 178 | lcd.refresh(); |
AhmedPlaymaker | 5:e4df87957a5b | 179 | wait(2); |
AhmedPlaymaker | 5:e4df87957a5b | 180 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 181 | lcd.clear(); |
AhmedPlaymaker | 3:fbb1fa853f09 | 182 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 183 | |
AhmedPlaymaker | 49:441c32f6603e | 184 | void StartScreen::read_stats(SDFileSystem &sd) |
AhmedPlaymaker | 49:441c32f6603e | 185 | { |
AhmedPlaymaker | 49:441c32f6603e | 186 | _stats.read(sd); |
AhmedPlaymaker | 49:441c32f6603e | 187 | } |
AhmedPlaymaker | 49:441c32f6603e | 188 | |
AhmedPlaymaker | 49:441c32f6603e | 189 | void StartScreen::main_menu(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 3:fbb1fa853f09 | 190 | { |
AhmedPlaymaker | 7:48ba87cd79b5 | 191 | lcd.clear(); |
AhmedPlaymaker | 52:c2faa96cf293 | 192 | //StartScreen::init(); |
AhmedPlaymaker | 32:3a3bdeffdf62 | 193 | pad.init(); |
AhmedPlaymaker | 29:c6358c39a70e | 194 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 34:89f53ffc81bb | 195 | StartScreen::DisplayMMContents(lcd, pad); |
AhmedPlaymaker | 3:fbb1fa853f09 | 196 | } |
AhmedPlaymaker | 6:3ffab44ed49c | 197 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 30:461231877c89 | 198 | wait(1/cs); |
AhmedPlaymaker | 49:441c32f6603e | 199 | StartScreen::ImplementMM(lcd, pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 200 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 201 | |
AhmedPlaymaker | 34:89f53ffc81bb | 202 | void StartScreen::DisplayMMContents(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 34:89f53ffc81bb | 203 | { |
AhmedPlaymaker | 34:89f53ffc81bb | 204 | lcd.printString("SnakeVSBlock",5,0); |
AhmedPlaymaker | 34:89f53ffc81bb | 205 | lcd.printString("Play",0,2); |
AhmedPlaymaker | 34:89f53ffc81bb | 206 | lcd.printString("Settings",0,3); |
AhmedPlaymaker | 34:89f53ffc81bb | 207 | lcd.printString("Stats",0,4); |
AhmedPlaymaker | 34:89f53ffc81bb | 208 | lcd.printString("Tutorial",0,5); |
AhmedPlaymaker | 34:89f53ffc81bb | 209 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 34:89f53ffc81bb | 210 | if((d==N)&&(i>16)) { |
AhmedPlaymaker | 34:89f53ffc81bb | 211 | i=i-8; |
AhmedPlaymaker | 34:89f53ffc81bb | 212 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 213 | if((d==S)&&(i<40)) { |
AhmedPlaymaker | 34:89f53ffc81bb | 214 | i=i+8; |
AhmedPlaymaker | 34:89f53ffc81bb | 215 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 216 | lcd.drawSprite(50,i,7,9,(int *)arrow); //Function used to draw the sprite. |
AhmedPlaymaker | 34:89f53ffc81bb | 217 | lcd.refresh(); |
AhmedPlaymaker | 34:89f53ffc81bb | 218 | wait(1/cs); |
AhmedPlaymaker | 34:89f53ffc81bb | 219 | lcd.clear(); |
AhmedPlaymaker | 34:89f53ffc81bb | 220 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 221 | |
AhmedPlaymaker | 49:441c32f6603e | 222 | void StartScreen::ImplementMM(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 55:df0825049171 | 223 | { |
AhmedPlaymaker | 55:df0825049171 | 224 | switch (i) { |
AhmedPlaymaker | 55:df0825049171 | 225 | case 16: |
AhmedPlaymaker | 49:441c32f6603e | 226 | game_mode(lcd, pad); |
AhmedPlaymaker | 55:df0825049171 | 227 | break; |
AhmedPlaymaker | 55:df0825049171 | 228 | case 24: |
AhmedPlaymaker | 30:461231877c89 | 229 | float *cs_sc; |
AhmedPlaymaker | 49:441c32f6603e | 230 | cs_sc = settings.Implement(lcd, pad, cs); |
AhmedPlaymaker | 30:461231877c89 | 231 | cs = cs_sc[0]; |
AhmedPlaymaker | 30:461231877c89 | 232 | sc = cs_sc[1]; |
AhmedPlaymaker | 49:441c32f6603e | 233 | main_menu(lcd, pad); |
AhmedPlaymaker | 55:df0825049171 | 234 | break; |
AhmedPlaymaker | 55:df0825049171 | 235 | case 32: |
AhmedPlaymaker | 49:441c32f6603e | 236 | _stats.StatsDisplay(lcd, pad); |
AhmedPlaymaker | 49:441c32f6603e | 237 | main_menu(lcd, pad); |
AhmedPlaymaker | 55:df0825049171 | 238 | break; |
AhmedPlaymaker | 55:df0825049171 | 239 | default: |
AhmedPlaymaker | 49:441c32f6603e | 240 | main_menu(lcd, pad); |
AhmedPlaymaker | 4:1fe015b66bb8 | 241 | lr=1; |
AhmedPlaymaker | 55:df0825049171 | 242 | break; |
AhmedPlaymaker | 55:df0825049171 | 243 | } |
AhmedPlaymaker | 3:fbb1fa853f09 | 244 | } |
AhmedPlaymaker | 30:461231877c89 | 245 | |
AhmedPlaymaker | 49:441c32f6603e | 246 | void StartScreen::game_mode(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 4:1fe015b66bb8 | 247 | { |
AhmedPlaymaker | 4:1fe015b66bb8 | 248 | lcd.clear(); |
AhmedPlaymaker | 16:7b474f873683 | 249 | wait(2/cs); |
AhmedPlaymaker | 30:461231877c89 | 250 | pad.init(); |
AhmedPlaymaker | 29:c6358c39a70e | 251 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 42:973bb6036f81 | 252 | StartScreen::ImplementGM(pad); |
AhmedPlaymaker | 42:973bb6036f81 | 253 | StartScreen::DisplayGMContents(lcd); |
AhmedPlaymaker | 34:89f53ffc81bb | 254 | if (pad.check_event(Gamepad::BACK_PRESSED) == true) { //This is a very important process, this helps the code to not get stuck in menu loop. |
AhmedPlaymaker | 34:89f53ffc81bb | 255 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 34:89f53ffc81bb | 256 | back_pressed = 1; |
AhmedPlaymaker | 34:89f53ffc81bb | 257 | break; |
AhmedPlaymaker | 4:1fe015b66bb8 | 258 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 259 | else {back_pressed = 0;} |
AhmedPlaymaker | 34:89f53ffc81bb | 260 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 261 | if(back_pressed) { |
AhmedPlaymaker | 49:441c32f6603e | 262 | main_menu(lcd, pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 263 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 264 | else { |
AhmedPlaymaker | 34:89f53ffc81bb | 265 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 29:c6358c39a70e | 266 | lcd.clear(); |
AhmedPlaymaker | 49:441c32f6603e | 267 | game_speed(lcd, pad); |
AhmedPlaymaker | 34:89f53ffc81bb | 268 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 269 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 270 | |
AhmedPlaymaker | 42:973bb6036f81 | 271 | void StartScreen::ImplementGM(Gamepad &pad) |
AhmedPlaymaker | 34:89f53ffc81bb | 272 | { |
AhmedPlaymaker | 34:89f53ffc81bb | 273 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 34:89f53ffc81bb | 274 | wait(1/cs); |
AhmedPlaymaker | 34:89f53ffc81bb | 275 | if(((d==E)||(d==W))&&(lr==1)) { |
AhmedPlaymaker | 34:89f53ffc81bb | 276 | lr=2; |
AhmedPlaymaker | 34:89f53ffc81bb | 277 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 278 | |
AhmedPlaymaker | 34:89f53ffc81bb | 279 | else if(((d==E)||(d==W))&&(lr==2)) { |
AhmedPlaymaker | 34:89f53ffc81bb | 280 | lr=1; |
AhmedPlaymaker | 34:89f53ffc81bb | 281 | } |
AhmedPlaymaker | 42:973bb6036f81 | 282 | } |
AhmedPlaymaker | 42:973bb6036f81 | 283 | |
AhmedPlaymaker | 42:973bb6036f81 | 284 | void StartScreen::DisplayGMContents(N5110 &lcd) |
AhmedPlaymaker | 42:973bb6036f81 | 285 | { |
AhmedPlaymaker | 34:89f53ffc81bb | 286 | lcd.clear(); |
AhmedPlaymaker | 34:89f53ffc81bb | 287 | lcd.drawRect(27,18,30,20,FILL_TRANSPARENT); |
AhmedPlaymaker | 34:89f53ffc81bb | 288 | lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. |
AhmedPlaymaker | 34:89f53ffc81bb | 289 | lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. |
AhmedPlaymaker | 55:df0825049171 | 290 | switch (lr) { |
AhmedPlaymaker | 55:df0825049171 | 291 | case 1: |
AhmedPlaymaker | 34:89f53ffc81bb | 292 | lcd.printString("Joystick",18,1); |
AhmedPlaymaker | 39:210ac915e0a0 | 293 | g_mode = 1; |
AhmedPlaymaker | 26:3495f7b0ede7 | 294 | lcd.refresh(); |
AhmedPlaymaker | 55:df0825049171 | 295 | break; |
AhmedPlaymaker | 55:df0825049171 | 296 | case 2: |
AhmedPlaymaker | 34:89f53ffc81bb | 297 | lcd.printString("Motion Control",1,1); |
AhmedPlaymaker | 39:210ac915e0a0 | 298 | g_mode = 2; |
AhmedPlaymaker | 34:89f53ffc81bb | 299 | lcd.drawSprite(29,19,13,5,(int *)bullet); //Function used to draw the sprite. |
AhmedPlaymaker | 55:df0825049171 | 300 | break; |
AhmedPlaymaker | 34:89f53ffc81bb | 301 | } |
AhmedPlaymaker | 55:df0825049171 | 302 | |
AhmedPlaymaker | 34:89f53ffc81bb | 303 | lcd.refresh(); |
AhmedPlaymaker | 4:1fe015b66bb8 | 304 | } |
AhmedPlaymaker | 34:89f53ffc81bb | 305 | |
AhmedPlaymaker | 49:441c32f6603e | 306 | void StartScreen::game_speed(N5110 &lcd, Gamepad &pad) |
AhmedPlaymaker | 4:1fe015b66bb8 | 307 | { |
AhmedPlaymaker | 4:1fe015b66bb8 | 308 | lcd.clear(); |
AhmedPlaymaker | 29:c6358c39a70e | 309 | wait(2/cs); |
AhmedPlaymaker | 30:461231877c89 | 310 | pad.init(); |
AhmedPlaymaker | 29:c6358c39a70e | 311 | while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. |
AhmedPlaymaker | 42:973bb6036f81 | 312 | StartScreen::ImplementGS(pad); |
AhmedPlaymaker | 42:973bb6036f81 | 313 | StartScreen::DisplayGSContents(lcd); |
AhmedPlaymaker | 35:ce47cde57bd3 | 314 | if (pad.check_event(Gamepad::BACK_PRESSED) == true) { //This is a very important process, this helps the code to not get stuck in menu loop. |
AhmedPlaymaker | 35:ce47cde57bd3 | 315 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 35:ce47cde57bd3 | 316 | back_pressed = 1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 317 | break; |
AhmedPlaymaker | 4:1fe015b66bb8 | 318 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 319 | else {back_pressed = 0;} |
AhmedPlaymaker | 35:ce47cde57bd3 | 320 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 321 | if(back_pressed) { |
AhmedPlaymaker | 49:441c32f6603e | 322 | game_mode(lcd, pad); |
AhmedPlaymaker | 35:ce47cde57bd3 | 323 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 324 | else { |
AhmedPlaymaker | 35:ce47cde57bd3 | 325 | pad.tone(1000.0,0.1); |
AhmedPlaymaker | 35:ce47cde57bd3 | 326 | lcd.clear(); |
AhmedPlaymaker | 35:ce47cde57bd3 | 327 | wait(1/cs); |
AhmedPlaymaker | 4:1fe015b66bb8 | 328 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 329 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 330 | |
AhmedPlaymaker | 42:973bb6036f81 | 331 | void StartScreen::ImplementGS(Gamepad &pad) |
AhmedPlaymaker | 35:ce47cde57bd3 | 332 | { |
AhmedPlaymaker | 35:ce47cde57bd3 | 333 | Direction d = pad.get_direction(); |
AhmedPlaymaker | 5:e4df87957a5b | 334 | wait(1/cs); |
AhmedPlaymaker | 35:ce47cde57bd3 | 335 | if((d==E)&&(gs==4)) { |
AhmedPlaymaker | 35:ce47cde57bd3 | 336 | gs=1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 337 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 338 | else if((d==W)&&(gs==1)) { |
AhmedPlaymaker | 35:ce47cde57bd3 | 339 | gs=4; |
AhmedPlaymaker | 35:ce47cde57bd3 | 340 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 341 | else if((d==E)&&(1<=gs<=3)) { |
AhmedPlaymaker | 35:ce47cde57bd3 | 342 | gs=gs+1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 343 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 344 | else if((d==W)&&(2<=gs<=4)) { |
AhmedPlaymaker | 35:ce47cde57bd3 | 345 | gs=gs-1; |
AhmedPlaymaker | 35:ce47cde57bd3 | 346 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 347 | } |
AhmedPlaymaker | 35:ce47cde57bd3 | 348 | |
AhmedPlaymaker | 42:973bb6036f81 | 349 | void StartScreen::DisplayGSContents(N5110 &lcd) |
AhmedPlaymaker | 35:ce47cde57bd3 | 350 | { |
AhmedPlaymaker | 35:ce47cde57bd3 | 351 | lcd.clear(); |
AhmedPlaymaker | 35:ce47cde57bd3 | 352 | lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. |
AhmedPlaymaker | 35:ce47cde57bd3 | 353 | lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. |
AhmedPlaymaker | 35:ce47cde57bd3 | 354 | lcd.printString("Game Speed",10,1); |
AhmedPlaymaker | 55:df0825049171 | 355 | switch (gs) { |
AhmedPlaymaker | 55:df0825049171 | 356 | case 1: |
AhmedPlaymaker | 55:df0825049171 | 357 | lcd.printString("SNAIL",28,3); |
AhmedPlaymaker | 35:ce47cde57bd3 | 358 | fps = 12; |
AhmedPlaymaker | 55:df0825049171 | 359 | break; |
AhmedPlaymaker | 55:df0825049171 | 360 | case 2: |
AhmedPlaymaker | 55:df0825049171 | 361 | lcd.printString("RABBIT",24,3); |
AhmedPlaymaker | 35:ce47cde57bd3 | 362 | fps = 18; |
AhmedPlaymaker | 55:df0825049171 | 363 | break; |
AhmedPlaymaker | 55:df0825049171 | 364 | case 3: |
AhmedPlaymaker | 55:df0825049171 | 365 | lcd.printString("HUMAN",28,3); |
AhmedPlaymaker | 35:ce47cde57bd3 | 366 | fps = 22; |
AhmedPlaymaker | 55:df0825049171 | 367 | break; |
AhmedPlaymaker | 55:df0825049171 | 368 | case 4: |
AhmedPlaymaker | 35:ce47cde57bd3 | 369 | lcd.printString("CHEETHA",21,3); |
AhmedPlaymaker | 35:ce47cde57bd3 | 370 | fps = 27; |
AhmedPlaymaker | 35:ce47cde57bd3 | 371 | } |
AhmedPlaymaker | 55:df0825049171 | 372 | |
AhmedPlaymaker | 21:e41126528cc6 | 373 | lcd.refresh(); |
AhmedPlaymaker | 4:1fe015b66bb8 | 374 | } |