Skip to content

Adjust SDL loop timing a bit#752

Merged
Gadgetoid merged 2 commits into32blit:masterfrom
Daft-Freak:sdl-update
Jan 13, 2023
Merged

Adjust SDL loop timing a bit#752
Gadgetoid merged 2 commits into32blit:masterfrom
Daft-Freak:sdl-update

Conversation

@Daft-Freak
Copy link
Copy Markdown
Collaborator

This fixes the fact that SDL only called tick every 20ms, so you would always be running behind and get two updates. Also switches render/tick around as SDL was backwards compared to STM32/Pico.

@Daft-Freak
Copy link
Copy Markdown
Collaborator Author

... and then I realise that this will have unstable render timing in Emscripten as loop gets called at [whatever your refresh rate is]... which probably isn't 100Hz... hmm...

(Which also means it was already running render at a different rate to everything else, and was also synced unlike the non-Emscripten SDL code)

@Daft-Freak Daft-Freak marked this pull request as draft February 16, 2022 12:31
Signal SDL loop every 10 ms but limit render to 20ms. Also call render
before update to match what stm32/pico do.
It doesn't run the main loop at 100Hz.
@Daft-Freak Daft-Freak marked this pull request as ready for review August 17, 2022 10:32
@Daft-Freak
Copy link
Copy Markdown
Collaborator Author

Came back to this as it helps the audio buffering in DaftBoy.

"Fixed" Emscripten by #ifdef-ing the render check. It's still the odd one out, running at the display refresh rate unlike SDL on anything else (the same as before this change)...

@Gadgetoid Gadgetoid merged commit 28c221a into 32blit:master Jan 13, 2023
@Gadgetoid
Copy link
Copy Markdown
Contributor

Thank you!

@Daft-Freak Daft-Freak deleted the sdl-update branch January 13, 2023 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants