Skip to content

Commit

Permalink
Don't limit emscripten refresh rate
Browse files Browse the repository at this point in the history
It doesn't run the main loop at 100Hz.
  • Loading branch information
Daft-Freak committed Aug 17, 2022
1 parent 15a5479 commit c97c518
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions 32blit-sdl/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,13 @@ void System::loop() {
blit::joystick.y = shadow_joystick[1];
SDL_UnlockMutex(m_input);

// only render at 50Hz
// only render at 50Hz (main loop runs at 100Hz)
// however, the emscripten loop (usually) runs at the display refresh rate
auto time_now = ::now();
if(time_now - last_render_time >= 20) {
#ifndef __EMSCRIPTEN__
if(time_now - last_render_time >= 20)
#endif
{
blit::render(time_now);
last_render_time = time_now;
}
Expand Down

0 comments on commit c97c518

Please sign in to comment.