test test test
Diff: snake-test/ELEC2645_ProjecT/MAIN.cpp
- Revision:
- 0:e4c5e6ec922e
diff -r 000000000000 -r e4c5e6ec922e snake-test/ELEC2645_ProjecT/MAIN.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/snake-test/ELEC2645_ProjecT/MAIN.cpp Mon May 25 19:06:11 2020 +0000 @@ -0,0 +1,40 @@ +/* mbed Microcontroller Library + * Copyright (c) 2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mbed.h" + +#include "N5110.h" +#include "Gamepad.h" +#include "SnakeEngine.h" + + +Gamepad gamePad; +N5110 lcd; +SnakeEngine snakeEngine(gamePad,lcd); + +int gameSpeed; + + + + +int main(){ + int fps = 6; + gamePad.init(); + gamePad.reset_buttons(); + + lcd.init(); + snakeEngine.init(); + snakeEngine.welcome(); + gameSpeed = snakeEngine.getGameSpeed(); // initiallize the game speed to lowest + + fps = gameSpeed*2; + while(true){ + snakeEngine.runGameEngine(); + gameSpeed = snakeEngine.getGameSpeed(); + fps = gameSpeed*2; + wait(1.0f/fps); // we wait accordingly to game speed + } + +} \ No newline at end of file