mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-14 17:04:22 +01:00
emscripten: Check whether window has focus at engine start
This commit is contained in:
parent
8b9c9e5541
commit
55692916e3
1 changed files with 4 additions and 0 deletions
|
@ -514,6 +514,10 @@ SYMBOL_EXPORT int libsuperderpy_run(struct Game* game) {
|
||||||
}
|
}
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, game, false, libsuperderpy_emscripten_focus_change);
|
emscripten_set_blur_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, game, false, libsuperderpy_emscripten_focus_change);
|
||||||
|
if (game->config.autopause && !EM_ASM_INT({document.hasFocus()})) {
|
||||||
|
PrintConsole(game, "Window not focused, autopausing...");
|
||||||
|
PauseExecution(game);
|
||||||
|
}
|
||||||
emscripten_set_main_loop_arg(libsuperderpy_emscripten_mainloop, game, 0, true);
|
emscripten_set_main_loop_arg(libsuperderpy_emscripten_mainloop, game, 0, true);
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue