
Kaif Kutchwala 201267448 ELEC2645 Project
Dependencies: mbed
Diff: main.cpp
- Revision:
- 17:2fbe40177b9c
- Parent:
- 16:1f196a0e12be
- Child:
- 18:100e7d3509b5
--- a/main.cpp Tue May 19 01:17:31 2020 +0000 +++ b/main.cpp Fri May 22 01:46:19 2020 +0000 @@ -76,6 +76,7 @@ //functions void init(); void display_menu(); +void game_loop(); void how_to(); void display_settings(); //variables @@ -89,14 +90,7 @@ //ball.level_loop(); display_menu(); if (pad.A_pressed()) { - wait(0.2); //debounce - game.init(); - game.play(); - lcd.clear(); - lcd.printString("GAME OVER",15,2); - lcd.refresh(); - wait(2); - pad.reset_buttons(); //to ensure no accidental selection on menu + game_loop(); } else if (pad.B_pressed()) { wait(0.2); //debounce @@ -123,8 +117,8 @@ lcd.setContrast(0.5); pad.init(); lcd.backLightOn(); - splash.displayInfo(); - splash.playIntro(); + //splash.displayInfo(); + //splash.playIntro(); } void display_menu() { @@ -148,6 +142,16 @@ wait(0.1); lcd.clear(); } +void game_loop() { + wait(0.2); //debounce + game.init(); + game.play(); + lcd.clear(); + lcd.printString("GAME OVER",15,2); + lcd.refresh(); + wait(2); + pad.reset_buttons(); //to ensure no accidental selection on menu +} void how_to() { //page 1 - b to exit, buttons on gamepad //page 2 - a to stop pointer, b to set power