Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: StartScreen/StartScreen.cpp
- Revision:
- 42:973bb6036f81
- Parent:
- 39:210ac915e0a0
diff -r 4edac50f010d -r 973bb6036f81 StartScreen/StartScreen.cpp --- a/StartScreen/StartScreen.cpp Tue Apr 23 12:25:49 2019 +0000 +++ b/StartScreen/StartScreen.cpp Tue Apr 23 15:22:09 2019 +0000 @@ -244,7 +244,8 @@ wait(2/cs); pad.init(); while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. - StartScreen::DisplayGMContents(lcd, pad); + StartScreen::ImplementGM(pad); + StartScreen::DisplayGMContents(lcd); 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. pad.tone(1000.0,0.1); back_pressed = 1; @@ -263,7 +264,7 @@ } } -void StartScreen::DisplayGMContents(N5110 &lcd, Gamepad &pad) +void StartScreen::ImplementGM(Gamepad &pad) { Direction d = pad.get_direction(); wait(1/cs); @@ -274,6 +275,10 @@ else if(((d==E)||(d==W))&&(lr==2)) { lr=1; } +} + +void StartScreen::DisplayGMContents(N5110 &lcd) +{ lcd.clear(); lcd.drawRect(27,18,30,20,FILL_TRANSPARENT); lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite. @@ -297,8 +302,8 @@ wait(2/cs); pad.init(); while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. - StartScreen::ImplementGS(lcd, pad); - StartScreen::DisplayGSContents(lcd, pad); + StartScreen::ImplementGS(pad); + StartScreen::DisplayGSContents(lcd); 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. pad.tone(1000.0,0.1); back_pressed = 1; @@ -320,7 +325,7 @@ } } -void StartScreen::ImplementGS(N5110 &lcd, Gamepad &pad) +void StartScreen::ImplementGS(Gamepad &pad) { Direction d = pad.get_direction(); wait(1/cs); @@ -338,7 +343,7 @@ } } -void StartScreen::DisplayGSContents(N5110 &lcd, Gamepad &pad) +void StartScreen::DisplayGSContents(N5110 &lcd) { lcd.clear(); lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.