mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-24 13:39:11 +00:00
emscripten: Introduce SDL_HINT_EMSCRIPTEN_ASYNCIFY
See https://github.com/emscripten-core/emscripten/issues/10746 and https://github.com/emscripten-ports/SDL2/pull/112 Fixes Bugzilla #4997.
This commit is contained in:
parent
01af7b0254
commit
e594a6738a
4 changed files with 22 additions and 4 deletions
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_assert.h"
|
||||
#include "SDL_hints.h"
|
||||
#include "../SDL_timer_c.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
|
@ -191,8 +192,8 @@ void
|
|||
SDL_Delay(Uint32 ms)
|
||||
{
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if (emscripten_has_asyncify()) {
|
||||
/* pseudo-synchronous pause */
|
||||
if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) {
|
||||
/* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */
|
||||
emscripten_sleep(ms);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue