diff options
Diffstat (limited to 'misc/dist/html/full-size.html')
-rw-r--r-- | misc/dist/html/full-size.html | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html index 85c5305b85..c7e657e53d 100644 --- a/misc/dist/html/full-size.html +++ b/misc/dist/html/full-size.html @@ -134,21 +134,14 @@ $GODOT_HEAD_INCLUDE <div id='status-notice' class='godot' style='display: none;'></div> </div> - <script type='text/javascript' src='$GODOT_BASENAME.js'></script> + <script type='text/javascript' src='$GODOT_URL'></script> <script type='text/javascript'>//<![CDATA[ - var engine = new Engine; - var setStatusMode; - var setStatusNotice; + const GODOT_CONFIG = $GODOT_CONFIG; + var engine = new Engine(GODOT_CONFIG); (function() { - const EXECUTABLE_NAME = '$GODOT_BASENAME'; - const MAIN_PACK = '$GODOT_BASENAME.pck'; - const EXTRA_ARGS = JSON.parse('$GODOT_ARGS'); - const GDNATIVE_LIBS = [$GODOT_GDNATIVE_LIBS]; const INDETERMINATE_STATUS_STEP_MS = 100; - const FULL_WINDOW = $GODOT_FULL_WINDOW; - var canvas = document.getElementById('canvas'); var statusProgress = document.getElementById('status-progress'); var statusProgressInner = document.getElementById('status-progress-inner'); @@ -180,14 +173,13 @@ $GODOT_HEAD_INCLUDE canvas.style.height = lastHeight + "px"; } } - if (FULL_WINDOW) { + if (GODOT_CONFIG['canvasResizePolicy'] == 2) { animationCallbacks.push(adjustCanvasDimensions); adjustCanvasDimensions(); - } else { - engine.setCanvasResizedOnStart(true); } - setStatusMode = function setStatusMode(mode) { + function setStatusMode(mode) { + if (statusMode === mode || !initializing) return; [statusProgress, statusIndeterminate, statusNotice].forEach(elem => { @@ -213,7 +205,7 @@ $GODOT_HEAD_INCLUDE throw new Error('Invalid status mode'); } statusMode = mode; - }; + } function animateStatusIndeterminate(ms) { var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8); @@ -225,7 +217,7 @@ $GODOT_HEAD_INCLUDE } } - setStatusNotice = function setStatusNotice(text) { + function setStatusNotice(text) { while (statusNotice.lastChild) { statusNotice.removeChild(statusNotice.lastChild); } @@ -236,21 +228,6 @@ $GODOT_HEAD_INCLUDE }); }; - engine.setProgressFunc((current, total) => { - if (total > 0) { - statusProgressInner.style.width = current/total * 100 + '%'; - setStatusMode('progress'); - if (current === total) { - // wait for progress bar animation - setTimeout(() => { - setStatusMode('indeterminate'); - }, 500); - } - } else { - setStatusMode('indeterminate'); - } - }); - function displayFailureNotice(err) { var msg = err.message || err; console.error(msg); @@ -263,9 +240,22 @@ $GODOT_HEAD_INCLUDE displayFailureNotice('WebGL not available'); } else { setStatusMode('indeterminate'); - engine.setCanvas(canvas); - engine.setGDNativeLibraries(GDNATIVE_LIBS); - engine.startGame(EXECUTABLE_NAME, MAIN_PACK, EXTRA_ARGS).then(() => { + engine.startGame({ + 'onProgress': function (current, total) { + if (total > 0) { + statusProgressInner.style.width = current/total * 100 + '%'; + setStatusMode('progress'); + if (current === total) { + // wait for progress bar animation + setTimeout(() => { + setStatusMode('indeterminate'); + }, 500); + } + } else { + setStatusMode('indeterminate'); + } + }, + }).then(() => { setStatusMode('hidden'); initializing = false; }, displayFailureNotice); |