![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: MenuClasses/StartScreen/StartScreen.cpp
- Revision:
- 55:df0825049171
- Parent:
- 52:c2faa96cf293
- Child:
- 56:142e9fdb77a8
--- a/MenuClasses/StartScreen/StartScreen.cpp Fri Apr 26 19:32:57 2019 +0000 +++ b/MenuClasses/StartScreen/StartScreen.cpp Sat Apr 27 18:56:30 2019 +0000 @@ -220,27 +220,27 @@ } void StartScreen::ImplementMM(N5110 &lcd, Gamepad &pad) -{ - if(i == 16) { +{ + switch (i) { + case 16: game_mode(lcd, pad); - } - else if(i == 24) { + break; + case 24: float *cs_sc; cs_sc = settings.Implement(lcd, pad, cs); - pad.tone(1000.0,0.1); cs = cs_sc[0]; sc = cs_sc[1]; main_menu(lcd, pad); - } - else if(i == 32) { + break; + case 32: _stats.StatsDisplay(lcd, pad); - pad.tone(1000.0,0.1); main_menu(lcd, pad); - } - else { + break; + default: main_menu(lcd, pad); lr=1; - } + break; + } } void StartScreen::game_mode(N5110 &lcd, Gamepad &pad) @@ -287,16 +287,19 @@ lcd.drawRect(27,18,30,20,FILL_TRANSPARENT); lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. - if(lr==1) { + switch (lr) { + case 1: lcd.printString("Joystick",18,1); g_mode = 1; lcd.refresh(); - } - if(lr==2) { + break; + case 2: lcd.printString("Motion Control",1,1); g_mode = 2; lcd.drawSprite(29,19,13,5,(int *)bullet); //Function used to draw the sprite. + break; } + lcd.refresh(); } @@ -322,12 +325,6 @@ pad.tone(1000.0,0.1); lcd.clear(); wait(1/cs); - /* - lcd.printString("Level:",25,1); //created so that the gamer can keep track of their game. //change this to be operated remotely - lcd.printString("1",40,3); - lcd.refresh(); - wait(2); - */ } } @@ -355,21 +352,23 @@ lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. lcd.printString("Game Speed",10,1); - if(gs==1) { - lcd.printString("SNAIL",26,3); + switch (gs) { + case 1: + lcd.printString("SNAIL",28,3); fps = 12; - } - if(gs==2) { - lcd.printString("TURTLE",24,3); + break; + case 2: + lcd.printString("RABBIT",24,3); fps = 18; - } - if(gs==3) { - lcd.printString("RABBIT",24,3); + break; + case 3: + lcd.printString("HUMAN",28,3); fps = 22; - } - if(gs==4) { + break; + case 4: lcd.printString("CHEETHA",21,3); fps = 27; } + lcd.refresh(); } \ No newline at end of file