previosly timing was calculating the next frame based on now + duration
when the correct timing should have been last_frame + duration.
This would have the effect of slowing the game down the higher your CPU
usage. A 0% CPU usage game would play at the request frame rate,
but a 100% CPU usage game would play at only half the requested frame rate.
(RR is render time below)
Timing with the bug:
60FPs requested, 35FPs actual, 3 frames, 87ms.
| 29ms | 29ms | 29ms |
| RR 12ms + 17ms sleep | RR 12ms + 17ms sleep | RR 12ms + 17ms sleep |
Timing after the fix:
60FPs, 60FPs actual, 3 frames, 51ms.
| 17ms | 17ms | 17ms |
| RR 12ms + sleep | RR 12ms + sleep | RR 12ms + sleep |
After this fix you may need to change your games timing mechanics or
adjust your frame rate (to slow things back down). Your game will run
faster after this fix, even if you were using "100% CPU" before.
Scroll down "Arduboy" logo was removed because the library now
provides a similar logo.
setup() and loop() moved to the beginning of the code.
Minor changes and cleanup.