mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-24 13:39:11 +00:00
emscripten: support pseudo-synchronous screen refresh and events update using asyncify
This commit is contained in:
parent
3b71ebecd6
commit
01af7b0254
3 changed files with 28 additions and 1 deletions
|
@ -31,6 +31,10 @@
|
|||
#include "SDL_assert.h"
|
||||
#include "../SDL_timer_c.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
/* The clock_gettime provides monotonous time, so we should use it if
|
||||
it's available. The clock_gettime function is behind ifdef
|
||||
for __USE_POSIX199309
|
||||
|
@ -186,6 +190,13 @@ SDL_GetPerformanceFrequency(void)
|
|||
void
|
||||
SDL_Delay(Uint32 ms)
|
||||
{
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if (emscripten_has_asyncify()) {
|
||||
/* pseudo-synchronous pause */
|
||||
emscripten_sleep(ms);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
int was_error;
|
||||
|
||||
#if HAVE_NANOSLEEP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue