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:
28
misc/dist/html/default.html
vendored
28
misc/dist/html/default.html
vendored
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user