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.
This commit is contained in:
Leon Krause
2018-03-15 04:00:32 +01:00
parent 955397dfd5
commit 61026e62bf
3 changed files with 32 additions and 23 deletions

View File

@ -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>