diff options
Diffstat (limited to 'misc/dist/html/full-size.html')
-rw-r--r-- | misc/dist/html/full-size.html | 67 |
1 files changed, 23 insertions, 44 deletions
diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html index 435013cb5e..f385b82f1d 100644 --- a/misc/dist/html/full-size.html +++ b/misc/dist/html/full-size.html @@ -1,9 +1,8 @@ <!DOCTYPE html> -<html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''> +<html xmlns='https://www.w3.org/1999/xhtml' lang='' xml:lang=''> <head> <meta charset='utf-8' /> <meta name='viewport' content='width=device-width, user-scalable=no' /> - <link id='-gd-engine-icon' rel='icon' type='image/png' href='favicon.png' /> <title>$GODOT_PROJECT_NAME</title> <style type='text/css'> @@ -81,6 +80,7 @@ } #status-indeterminate { + height: 42px; visibility: visible; position: relative; } @@ -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 INDETERMINATE_STATUS_STEP_MS = 100; - - var canvas = document.getElementById('canvas'); var statusProgress = document.getElementById('status-progress'); var statusProgressInner = document.getElementById('status-progress-inner'); var statusIndeterminate = document.getElementById('status-indeterminate'); @@ -164,17 +157,7 @@ $GODOT_HEAD_INCLUDE } requestAnimationFrame(animate); - function adjustCanvasDimensions() { - var scale = window.devicePixelRatio || 1; - var width = window.innerWidth; - var height = window.innerHeight; - canvas.width = width * scale; - canvas.height = height * scale; - } - animationCallbacks.push(adjustCanvasDimensions); - adjustCanvasDimensions(); - - setStatusMode = function setStatusMode(mode) { + function setStatusMode(mode) { if (statusMode === mode || !initializing) return; @@ -204,7 +187,6 @@ $GODOT_HEAD_INCLUDE } function animateStatusIndeterminate(ms) { - var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8); if (statusIndeterminate.children[i].style.borderTopColor == '') { Array.prototype.slice.call(statusIndeterminate.children).forEach(child => { @@ -214,8 +196,7 @@ $GODOT_HEAD_INCLUDE } } - setStatusNotice = function setStatusNotice(text) { - + function setStatusNotice(text) { while (statusNotice.lastChild) { statusNotice.removeChild(statusNotice.lastChild); } @@ -226,22 +207,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); @@ -254,8 +219,22 @@ $GODOT_HEAD_INCLUDE displayFailureNotice('WebGL not available'); } else { setStatusMode('indeterminate'); - engine.setCanvas(canvas); - 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); |