submit
Dependencies: mbed Gamepad N5110
Diff: main.cpp
- Revision:
- 6:feb6351e6f8e
- Parent:
- 5:82094591b4b4
- Child:
- 8:b6ddc8e10da6
diff -r 82094591b4b4 -r feb6351e6f8e main.cpp --- a/main.cpp Sun Apr 14 07:42:50 2019 +0000 +++ b/main.cpp Sun Apr 14 16:34:17 2019 +0000 @@ -18,8 +18,9 @@ ///////////// 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 @@ -29,7 +30,7 @@ wait(1.0f/fps); // and wait for one frame period } over(); - + } } // this function draws each frame on the LCD @@ -38,9 +39,10 @@ // clear screen, re-draw and refresh lcd.clear(); int length = snake.get_length(); + int direction = engine.get_direction(pad); snake.check_eat(pad); snake.draw(lcd,length); - int direction = engine.get_direction(pad); + // int direction = engine.get_direction(pad); snake.update(direction,length); snake.check_over(lcd); lcd.refresh(); @@ -53,7 +55,8 @@ lcd.init(); pad.init(); snake.init(2,3); - + engine.init(); + } void over()