submit
Dependencies: mbed Gamepad N5110
Diff: main.cpp
- Revision:
- 10:68076e3dcc33
- Parent:
- 9:18b059e5abb9
- Child:
- 11:543c62bed764
--- a/main.cpp Sat Apr 20 08:15:10 2019 +0000 +++ b/main.cpp Sat Apr 20 15:15:44 2019 +0000 @@ -15,18 +15,21 @@ void init(); void run(); void over(); + ///////////// functions //////////////// int main() { - int fps = 8; // frames per second while(1){ init(); engine.welcome(pad,lcd); // show welcome display, waiting for the user to start - engine.select(pad,lcd); // show the select display, waiting for the user to select + engine.menu(pad,lcd); // show the select display, waiting for the user to select // game loop - read input, update the game state and render the display while (snake.over == 0) { run(); // run the game + while (pad.check_event(Gamepad::START_PRESSED) == true){ + engine.pause(pad,lcd); + } wait(engine.p/fps); // and wait for one frame period } over(); // show gameover display, waiting for the user to restart