Craig Evans
/
ELEC2645_Pong2021
Pong game for ELEC1620 board.
Diff: main.cpp
- Revision:
- 2:482d74ef09c8
- Parent:
- 1:d63a63f0d397
- Child:
- 3:5746c6833d73
diff -r d63a63f0d397 -r 482d74ef09c8 main.cpp --- a/main.cpp Fri Mar 05 16:58:05 2021 +0000 +++ b/main.cpp Wed Mar 10 16:37:52 2021 +0000 @@ -29,14 +29,15 @@ init(); // initialise devices and objects welcome(); // waiting for the user to start render(); // first draw the initial frame - thread_sleep_for(500); // and wait for one frame period (100 ms - 10 fps + int fps = 1000/10; // 10 fps + thread_sleep_for(fps); // and wait for one frame period - millseconds while (1) { // read the joystick input and store in a struct UserInput input = {joystick.get_direction(),joystick.get_mag()}; pong.update(input); // update the game engine based on input render(); // draw frame on screen - thread_sleep_for(500); // 100 ms - 10 f.p.s + thread_sleep_for(fps); // and wait for one frame period - ms } }