Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust SDL loop timing a bit #752

Merged
merged 2 commits into from
Jan 13, 2023
Merged

Conversation

Daft-Freak
Copy link
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
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
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
Contributor

Thank you!

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