diff options
author | Leon Krause <lk@leonkrause.com> | 2018-03-15 04:00:32 +0100 |
---|---|---|
committer | Leon Krause <lk@leonkrause.com> | 2018-03-15 04:04:24 +0100 |
commit | 61026e62bf8659a4ffe4fc1b5cbd404d3e25adeb (patch) | |
tree | 5b5d883fe1e3997c494b5da21fe7352b343d501a /misc | |
parent | 955397dfd5845c0bd1510581a77d20989f13ab19 (diff) |
Check only for WebGL 1.0, move test to HTML file
Whether to use WebGL 1.0 or 2.0 can only be determined at runtime after
reading project settings, so check for the lower version.
The test is now in the HTML file, so if desired WebGL 2.0 can be
checked early by changing the behaviour there.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/dist/html/default.html | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/misc/dist/html/default.html b/misc/dist/html/default.html index a1a4e89d02..4e3515a7b6 100644 --- a/misc/dist/html/default.html +++ b/misc/dist/html/default.html @@ -244,9 +244,6 @@ $GODOT_HEAD_INCLUDE var statusMode = 'hidden'; var indeterminiateStatusAnimationId = 0; - setStatusMode('indeterminate'); - engine.setCanvas(canvas); - function setStatusMode(mode) { if (statusMode === mode || !initializing) @@ -367,18 +364,27 @@ $GODOT_HEAD_INCLUDE }); } - engine.startGame(BASENAME + '.pck').then(() => { - setStatusMode('hidden'); - initializing = false; - }, err => { + function displayFailureNotice(err) { + var msg = err.message || err; if (DEBUG_ENABLED) { - printError(err.message); - console.warn(err); + printError(msg); } - setStatusNotice(err.message); + console.error(msg); + setStatusNotice(msg); setStatusMode('notice'); initializing = false; - }); + }; + + if (!Engine.isWebGLAvailable()) { + displayFailureNotice("WebGL not available"); + } else { + setStatusMode('indeterminate'); + engine.setCanvas(canvas); + engine.startGame(BASENAME + '.pck').then(() => { + setStatusMode('hidden'); + initializing = false; + }, displayFailureNotice); + } })(); //]]></script> </body> |