summaryrefslogtreecommitdiff
path: root/misc/dist/html
diff options
context:
space:
mode:
authorLeon Krause <lk@leonkrause.com>2017-11-19 15:30:09 +0100
committerLeon Krause <lk@leonkrause.com>2017-11-19 15:39:57 +0100
commit35adf718cfdb4950177f645b30340d93dc2499bf (patch)
tree11dd095ca2af57078b253e11ef003ac0a2045828 /misc/dist/html
parent9107357c8dfda98c5adb33d3c5f4a7be1996fa07 (diff)
Change HTML5 start-up API
Rename engine.start() to startGame(), new start() takes string arguments handed directly to main(). Rename Engine.loadEngine() to load(). Add setLocale(), setResizeCanvasOnStart(), setExecutableName() and preloadFile().
Diffstat (limited to 'misc/dist/html')
-rw-r--r--misc/dist/html/default.html25
1 files changed, 13 insertions, 12 deletions
diff --git a/misc/dist/html/default.html b/misc/dist/html/default.html
index 91193eea47..0f78fc640e 100644
--- a/misc/dist/html/default.html
+++ b/misc/dist/html/default.html
@@ -225,7 +225,7 @@ $GODOT_HEAD_INCLUDE
<script type="text/javascript" src="$GODOT_BASENAME.js"></script>
<script type="text/javascript">//<![CDATA[
- var game = new Engine;
+ var engine = new Engine;
(function() {
@@ -245,7 +245,7 @@ $GODOT_HEAD_INCLUDE
var indeterminiateStatusAnimationId = 0;
setStatusMode('indeterminate');
- game.setCanvas(canvas);
+ engine.setCanvas(canvas);
function setStatusMode(mode) {
@@ -300,7 +300,7 @@ $GODOT_HEAD_INCLUDE
});
};
- game.setProgressFunc((current, total) => {
+ engine.setProgressFunc((current, total) => {
if (total > 0) {
statusProgressInner.style.width = current/total * 100 + '%';
@@ -330,10 +330,6 @@ $GODOT_HEAD_INCLUDE
outputRoot.style.display = 'block';
function print(text) {
- if (arguments.length > 1) {
- text = Array.prototype.slice.call(arguments).join(" ");
- }
- if (text.length <= 0) return;
while (outputScroll.childElementCount >= OUTPUT_MSG_COUNT_MAX) {
outputScroll.firstChild.remove();
}
@@ -354,26 +350,31 @@ $GODOT_HEAD_INCLUDE
};
function printError(text) {
- print('**ERROR**' + ":", text);
+ if (!text.startsWith('**ERROR**: ')) {
+ text = '**ERROR**: ' + text;
+ }
+ print(text);
}
- game.setStdoutFunc(text => {
+ engine.setStdoutFunc(text => {
print(text);
console.log(text);
});
- game.setStderrFunc(text => {
+ engine.setStderrFunc(text => {
printError(text);
console.warn(text);
});
}
- game.start(BASENAME + '.pck').then(() => {
+ engine.startGame(BASENAME + '.pck').then(() => {
setStatusMode('hidden');
initializing = false;
}, err => {
- if (DEBUG_ENABLED)
+ if (DEBUG_ENABLED) {
printError(err.message);
+ console.warn(err);
+ }
setStatusNotice(err.message);
setStatusMode('notice');
initializing = false;