mirror of
https://github.com/encounter/SDL.git
synced 2025-12-16 08:27:05 +00:00
emscripten: support pseudo-synchronous screen refresh and events update using asyncify
This commit is contained in:
@@ -162,6 +162,12 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec
|
||||
SDL_GetWindowID(window), ++frame_number);
|
||||
SDL_SaveBMP(surface, file);
|
||||
}*/
|
||||
|
||||
if (emscripten_has_asyncify()) {
|
||||
/* give back control to browser for screen refresh */
|
||||
emscripten_sleep(0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,9 +82,19 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) {
|
||||
}
|
||||
|
||||
SDL_EGL_CreateContext_impl(Emscripten)
|
||||
SDL_EGL_SwapWindow_impl(Emscripten)
|
||||
SDL_EGL_MakeCurrent_impl(Emscripten)
|
||||
|
||||
int
|
||||
Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window)
|
||||
{
|
||||
EGLBoolean ret = SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
|
||||
if (emscripten_has_asyncify()) {
|
||||
/* give back control to browser for screen refresh */
|
||||
emscripten_sleep(0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user