Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: main.cpp
- Revision:
- 25:e827f1a8fadc
- Parent:
- 16:7b474f873683
- Child:
- 32:3a3bdeffdf62
diff -r 1c118b071430 -r e827f1a8fadc main.cpp --- a/main.cpp Wed Apr 10 10:59:15 2019 +0000 +++ b/main.cpp Wed Apr 10 14:37:05 2019 +0000 @@ -46,21 +46,27 @@ _start.screen_saver(lcd, pad); _start.instruct(lcd, pad); _start.info(lcd, pad); - _start.menu_screen1(lcd, pad); - fps = _start.fps; - // start the game - refresh_game(); - wait(1.0f/fps); - - // snakeVSblock - detect input respect to the menu options, and update data and refresh screen - while (1) { - - game.read_input(pad); - game.update(pad); + while(1) { + _start.menu_screen1(lcd, pad); + fps = _start.fps; + // start the game refresh_game(); - wait(1.0f/fps); - + wait(1.0f/fps); + + // snakeVSblock - detect input respect to the menu options, and update data and refresh screen + while (1) { + + game.read_input(pad); + int back = game.update(pad); + refresh_game(); + + wait(1.0f/fps); + if(back) { + break; + } + + } } }