Skip to content

[WASM] Option to use main loop timing 'timeout' instead of 'requestAnimationFrame' (RAF) #2578

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

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

AlexandreK38
Copy link
Contributor

In Webgl , there are several timings to run the main loop. Current one implemented in Axmol is the requestAnimationFrame one (RAF) but if the app loses focus the loop is paused.
If we want the app to run with or without focus, for example in a multiplayer game, we must use the timeout timing.

This PR adds the AX_WASM_TIMING_USE_TIMEOUT option to use the timeout with the FPS set by Application::setAnimationInterval.

@halx99 halx99 added this to the 2.6.2 milestone Jun 27, 2025
@halx99 halx99 added the enhancement New feature or request label Jun 27, 2025
@halx99 halx99 merged commit 8d64b2f into axmolengine:dev Jun 27, 2025
15 checks passed
emscripten_set_main_loop(updateFrame, -1, false);
#endif

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!,,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants