contains my game for the embedded systems project 2645
Dependencies: mbed FXOS8700CQQQ
Diff: GameMenus/Menus.cpp
- Revision:
- 30:c5060010a1e6
- Parent:
- 29:e660274d8222
- Child:
- 31:4d4a9d78cae5
diff -r e660274d8222 -r c5060010a1e6 GameMenus/Menus.cpp --- a/GameMenus/Menus.cpp Thu Apr 25 10:44:53 2019 +0000 +++ b/GameMenus/Menus.cpp Sat Apr 27 02:00:28 2019 +0000 @@ -32,8 +32,9 @@ lcd.printString("MAIN MENU", 15, 0); lcd.drawLine(1, 10,80 ,10,1); lcd.printString("Play -A", 2, 2); - lcd.printString("Instructions-B", 1, 3); - lcd.printString("Credits - X", 1, 4); + lcd.printString("Play /acc -Y", 2, 3); + lcd.printString("Instructions-B", 1, 4); + lcd.printString("Credits - X", 1, 5); pad.leds_off(); wait(0.1); pad.leds_on(); @@ -45,21 +46,23 @@ } -void Menus::check_button_pressed(Gamepad &pad,N5110 &lcd){ - +void Menus::check_button_pressed(Gamepad &pad,N5110 &lcd){ if (pad.check_event(Gamepad::A_PRESSED) == true){ pad.leds_off(); while(1){ Rocket_Race.Game_Loop(lcd,pad); } - } - else if (pad.check_event(Gamepad::B_PRESSED) == true){ + }else if (pad.check_event(Gamepad::B_PRESSED) == true){ InstructionsMenu(pad,lcd); if (pad.check_event(Gamepad::BACK_PRESSED) == true){ drawMenu(lcd,pad); } - } - else if (pad.check_event(Gamepad::X_PRESSED) == true){ + }else if (pad.check_event(Gamepad::Y_PRESSED) == true){ + pad.leds_off(); + while(1){ + Rocket_Race.Game_Loop_accelerometer(lcd,pad); + } + }else if (pad.check_event(Gamepad::X_PRESSED) == true){ credits(lcd,pad); if (pad.check_event(Gamepad::BACK_PRESSED) == true){ drawMenu(lcd,pad); @@ -78,15 +81,13 @@ lcd.printString("< press BACK ", 12, 5); - lcd.refresh(); wait(0.5); while ( pad.check_event(Gamepad::BACK_PRESSED) == false){//keep looping since back not pressed pad.leds_on();//turn all leds on wait(0.1); pad.leds_off();//turn all leds off - wait(0.1); - + wait(0.1); } }