Update #53 - Improved FPS, reduced WebGL context loss crashes

This commit is contained in:
lax1dude
2025-07-06 12:31:55 -07:00
parent f3281c037f
commit 332a7bb11f
53 changed files with 568 additions and 383 deletions

View File

@ -118,7 +118,8 @@ async function initPlatformInput(inputImports) {
blur: null,
pointerlock: null,
pointerlockerr: null,
fullscreenChange: null
fullscreenChange: null,
visibilitychange: null
};
touchKeyboardOpenZone = document.createElement("div");
@ -351,6 +352,11 @@ async function initPlatformInput(inputImports) {
pushEvent(EVENT_TYPE_INPUT, EVENT_INPUT_FOCUS, null);
});
document.addEventListener("visibilitychange", currentEventListeners.visibilitychange = function(/** Event */ evt) {
if (handleVisibilityChange)
handleVisibilityChange();
});
/**
* @param {number} evtType
* @param {KeyboardEvent} evt
@ -1138,6 +1144,10 @@ async function initPlatformInput(inputImports) {
window.removeEventListener("blur", /** @type {function(Event)} */ (currentEventListeners.blur));
currentEventListeners.blur = null;
}
if(currentEventListeners.visibilitychange) {
document.removeEventListener("visibilitychange", currentEventListeners.visibilitychange);
currentEventListeners.visibilitychange = null;
}
if(currentEventListeners.pointerlock) {
document.removeEventListener("pointerlockchange", /** @type {function(Event)} */ (currentEventListeners.pointerlock));
currentEventListeners.pointerlock = null;