2016-01-20 03:21:29 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
2017-03-28 03:21:21 +02:00
|
|
|
<title></title>
|
2016-01-20 03:21:29 +01:00
|
|
|
<style type="text/css">
|
|
|
|
body {
|
|
|
|
margin: 0;
|
|
|
|
border: 0 none;
|
|
|
|
padding: 0;
|
|
|
|
text-align: center;
|
2017-01-12 14:14:40 +01:00
|
|
|
background-color: #222226;
|
2017-03-28 03:21:21 +02:00
|
|
|
font-family: 'Droid Sans', Arial, sans-serif;
|
2016-01-20 03:21:29 +01:00
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
/* Godot Engine default theme style
|
|
|
|
* ================================ */
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
.godot {
|
|
|
|
color: #e0e0e0;
|
|
|
|
background-color: #3b3943;
|
|
|
|
background-image: linear-gradient(to bottom, #403e48, #35333c);
|
|
|
|
border: 1px solid #45434e;
|
|
|
|
box-shadow: 0 0 1px 1px #2f2d35;
|
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
button.godot {
|
2017-03-28 03:21:21 +02:00
|
|
|
font-family: 'Droid Sans', Arial, sans-serif; /* override user agent style */
|
2016-01-20 03:21:29 +01:00
|
|
|
padding: 1px 5px;
|
|
|
|
background-color: #37353f;
|
|
|
|
background-image: linear-gradient(to bottom, #413e49, #3a3842);
|
|
|
|
border: 1px solid #514f5d;
|
|
|
|
border-radius: 1px;
|
|
|
|
box-shadow: 0 0 1px 1px #2a2930;
|
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
button.godot:hover {
|
|
|
|
color: #f0f0f0;
|
|
|
|
background-color: #44414e;
|
|
|
|
background-image: linear-gradient(to bottom, #494652, #423f4c);
|
|
|
|
border: 1px solid #5a5667;
|
|
|
|
box-shadow: 0 0 1px 1px #26252b;
|
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
button.godot:active {
|
|
|
|
color: #fff;
|
|
|
|
background-color: #3e3b46;
|
|
|
|
background-image: linear-gradient(to bottom, #36343d, #413e49);
|
|
|
|
border: 1px solid #4f4c59;
|
|
|
|
box-shadow: 0 0 1px 1px #26252b;
|
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
button.godot:disabled {
|
|
|
|
color: rgba(230, 230, 230, 0.2);
|
|
|
|
background-color: #3d3d3d;
|
|
|
|
background-image: linear-gradient(to bottom, #434343, #393939);
|
|
|
|
border: 1px solid #474747;
|
|
|
|
box-shadow: 0 0 1px 1px #2d2b33;
|
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
/* Canvas / wrapper
|
|
|
|
* ================ */
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
#container {
|
|
|
|
display: inline-block; /* scale with canvas */
|
|
|
|
vertical-align: top; /* prevent extra height */
|
|
|
|
position: relative; /* root for absolutely positioned overlay */
|
|
|
|
margin: 0;
|
|
|
|
border: 0 none;
|
|
|
|
padding: 0;
|
2017-01-12 14:14:40 +01:00
|
|
|
background-color: #0c0c0c;
|
2016-01-20 03:21:29 +01:00
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
#canvas {
|
|
|
|
display: block;
|
|
|
|
margin: 0 auto;
|
|
|
|
/* canvas must have border and padding set to zero to
|
|
|
|
* calculate cursor coordinates correctly */
|
|
|
|
border: 0 none;
|
|
|
|
padding: 0;
|
2017-01-12 14:14:40 +01:00
|
|
|
color: white;
|
2016-01-20 03:21:29 +01:00
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2017-07-22 15:43:05 +02:00
|
|
|
#canvas:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
/* Status display
|
|
|
|
* ============== */
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
#status-container {
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
2016-01-20 19:56:27 +01:00
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
/* don't consume click events - make children visible explicitly */
|
|
|
|
visibility: hidden;
|
2016-01-20 03:21:29 +01:00
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
#status {
|
2017-01-12 14:14:40 +01:00
|
|
|
line-height: 1.3;
|
|
|
|
cursor: pointer;
|
2016-01-20 19:56:27 +01:00
|
|
|
visibility: visible;
|
2016-01-20 03:21:29 +01:00
|
|
|
padding: 4px 6px;
|
|
|
|
}
|
2015-09-10 05:10:54 +02:00
|
|
|
|
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
/* Debug output
|
|
|
|
* ============ */
|
|
|
|
|
2017-01-12 14:14:40 +01:00
|
|
|
#output-panel {
|
2016-01-20 03:21:29 +01:00
|
|
|
display: none;
|
2017-03-28 03:21:21 +02:00
|
|
|
max-width: 700px;
|
2017-01-12 14:14:40 +01:00
|
|
|
font-size: small;
|
|
|
|
margin: 6px auto 0;
|
|
|
|
padding: 0 4px 4px;
|
2016-01-20 03:21:29 +01:00
|
|
|
text-align: left;
|
2017-01-12 14:14:40 +01:00
|
|
|
line-height: 2.2;
|
|
|
|
}
|
|
|
|
|
|
|
|
#output-header {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
#output-container {
|
|
|
|
padding: 6px;
|
|
|
|
background-color: #2c2a32;
|
|
|
|
box-shadow: inset 0 0 1px 1px #232127;
|
|
|
|
color: #bbb;
|
|
|
|
}
|
|
|
|
|
|
|
|
#output-scroll {
|
|
|
|
line-height: 1;
|
|
|
|
height: 12em;
|
|
|
|
overflow-y: scroll;
|
2016-01-20 03:21:29 +01:00
|
|
|
white-space: pre-wrap;
|
|
|
|
font-size: small;
|
|
|
|
font-family: "Lucida Console", Monaco, monospace;
|
|
|
|
}
|
|
|
|
</style>
|
2017-03-28 03:21:21 +02:00
|
|
|
$GODOT_HEAD_INCLUDE
|
2016-01-20 03:21:29 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="container">
|
2017-07-22 15:43:05 +02:00
|
|
|
<canvas id="canvas" width="640" height="480" tabindex="0" oncontextmenu="event.preventDefault();">
|
2017-01-12 14:14:40 +01:00
|
|
|
HTML5 canvas appears to be unsupported in the current browser.<br />
|
|
|
|
Please try updating or use a different browser.
|
2016-01-20 03:21:29 +01:00
|
|
|
</canvas>
|
2016-01-20 19:56:27 +01:00
|
|
|
<div id="status-container">
|
2017-01-12 14:14:40 +01:00
|
|
|
<span id="status" class="godot" onclick="this.style.visibility='hidden';">Downloading page...</span>
|
2016-01-20 19:56:27 +01:00
|
|
|
</div>
|
2016-01-20 03:21:29 +01:00
|
|
|
</div>
|
2017-01-12 14:14:40 +01:00
|
|
|
<div id="output-panel" class="godot">
|
|
|
|
<div id="output-header">
|
|
|
|
Output:
|
|
|
|
<button class="godot" type="button" autocomplete="off" onclick="Presentation.clearOutput();">Clear</button>
|
|
|
|
</div>
|
|
|
|
<div id="output-container"><div id="output-scroll"></div></div>
|
|
|
|
</div>
|
2016-01-20 03:21:29 +01:00
|
|
|
|
2017-01-12 14:14:40 +01:00
|
|
|
<!-- Scripts -->
|
2016-01-20 03:21:29 +01:00
|
|
|
<script type="text/javascript">//<![CDATA[
|
|
|
|
var Presentation = (function() {
|
|
|
|
var statusElement = document.getElementById("status");
|
2017-01-12 14:14:40 +01:00
|
|
|
var canvasElement = document.getElementById("canvas");
|
2016-01-20 03:21:29 +01:00
|
|
|
|
|
|
|
var presentation = {
|
2017-03-28 03:21:21 +02:00
|
|
|
postRun: [],
|
2016-01-20 03:21:29 +01:00
|
|
|
setStatusVisible: function setStatusVisible(visible) {
|
2017-03-28 03:21:21 +02:00
|
|
|
statusElement.style.visibility = (visible ? "visible" : "hidden");
|
2016-01-20 03:21:29 +01:00
|
|
|
},
|
|
|
|
setStatus: function setStatus(text) {
|
2017-01-12 14:14:40 +01:00
|
|
|
if (text.length === 0) {
|
|
|
|
// emscripten sets empty string as status after "Running..."
|
|
|
|
// per timeout, but another status may have been set by then
|
|
|
|
if (Presentation.setStatus.lastText === "Running...")
|
|
|
|
Presentation.setStatusVisible(false);
|
|
|
|
return;
|
2016-01-20 03:21:29 +01:00
|
|
|
}
|
2017-01-12 14:14:40 +01:00
|
|
|
Presentation.setStatus.lastText = text;
|
|
|
|
while (statusElement.lastChild) {
|
|
|
|
statusElement.removeChild(statusElement.lastChild);
|
|
|
|
}
|
|
|
|
var lines = text.split("\n");
|
|
|
|
lines.forEach(function(line, index) {
|
|
|
|
statusElement.appendChild(document.createTextNode(line));
|
|
|
|
statusElement.appendChild(document.createElement("br"));
|
|
|
|
});
|
|
|
|
var closeNote = document.createElement("span");
|
|
|
|
closeNote.style.fontSize = "small";
|
|
|
|
closeNote.textContent = "click to close";
|
|
|
|
statusElement.appendChild(closeNote);
|
|
|
|
Presentation.setStatusVisible(true);
|
|
|
|
},
|
2017-01-31 03:46:30 +01:00
|
|
|
isWebGL2Available: function isWebGL2Available() {
|
2017-01-12 14:14:40 +01:00
|
|
|
var context;
|
|
|
|
try {
|
2017-01-31 03:46:30 +01:00
|
|
|
context = canvasElement.getContext("webgl2") || canvasElement.getContext("experimental-webgl2");
|
2017-01-12 14:14:40 +01:00
|
|
|
} catch (e) {}
|
|
|
|
return !!context;
|
2016-01-20 03:21:29 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2017-01-12 14:14:40 +01:00
|
|
|
window.onerror = function(event) { presentation.setStatus("Failure during start-up\nSee JavaScript console") };
|
|
|
|
|
2016-01-20 03:21:29 +01:00
|
|
|
if ($GODOT_DEBUG_ENABLED) { // debugging enabled
|
2017-01-12 14:14:40 +01:00
|
|
|
var outputRoot = document.getElementById("output-panel");
|
|
|
|
var outputElement = document.getElementById("output-scroll");
|
|
|
|
const maxOutputMessages = 400;
|
|
|
|
|
|
|
|
presentation.setOutputVisible = function setOutputVisible(visible) {
|
2017-03-28 03:21:21 +02:00
|
|
|
outputRoot.style.display = (visible ? "block" : "none");
|
2017-01-12 14:14:40 +01:00
|
|
|
};
|
|
|
|
presentation.clearOutput = function clearOutput() {
|
|
|
|
while (outputElement.firstChild) {
|
|
|
|
outputElement.firstChild.remove();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
presentation.setOutputVisible(true);
|
|
|
|
|
|
|
|
presentation.print = function print(text) {
|
|
|
|
if (arguments.length > 1) {
|
|
|
|
text = Array.prototype.slice.call(arguments).join(" ");
|
|
|
|
}
|
|
|
|
if (text.length <= 0) return;
|
|
|
|
while (outputElement.childElementCount >= maxOutputMessages) {
|
|
|
|
outputElement.firstChild.remove();
|
|
|
|
}
|
|
|
|
var msg = document.createElement("div");
|
2017-01-31 03:46:30 +01:00
|
|
|
if (String.prototype.trim.call(text).startsWith("**ERROR**")
|
|
|
|
|| String.prototype.trim.call(text).startsWith("**EXCEPTION**")) {
|
2017-01-12 14:14:40 +01:00
|
|
|
msg.style.color = "#d44";
|
2017-01-31 03:46:30 +01:00
|
|
|
} else if (String.prototype.trim.call(text).startsWith("**WARNING**")) {
|
2017-01-12 14:14:40 +01:00
|
|
|
msg.style.color = "#ccc000";
|
2017-01-31 03:46:30 +01:00
|
|
|
} else if (String.prototype.trim.call(text).startsWith("**SCRIPT ERROR**")) {
|
2017-01-12 14:14:40 +01:00
|
|
|
msg.style.color = "#c6d";
|
|
|
|
}
|
|
|
|
msg.textContent = text;
|
|
|
|
var scrollToBottom = outputElement.scrollHeight - (outputElement.clientHeight + outputElement.scrollTop) < 10;
|
|
|
|
outputElement.appendChild(msg);
|
|
|
|
if (scrollToBottom) {
|
|
|
|
outputElement.scrollTop = outputElement.scrollHeight;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
presentation.postRun.push(function() {
|
|
|
|
window.onerror = function(event) { presentation.print("**EXCEPTION**:", event) };
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
presentation.postRun.push(function() { window.onerror = null; });
|
2016-01-20 03:21:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return presentation;
|
|
|
|
})();
|
|
|
|
|
|
|
|
// Emscripten interface
|
2017-03-28 03:21:21 +02:00
|
|
|
var Module = (function() {
|
|
|
|
const BASE_NAME = '$GODOT_BASE';
|
|
|
|
var module = {
|
|
|
|
thisProgram: BASE_NAME,
|
|
|
|
wasmBinaryFile: BASE_NAME + '.wasm',
|
|
|
|
TOTAL_MEMORY: $GODOT_TMEM,
|
|
|
|
print: function print(text) {
|
|
|
|
if (arguments.length > 1) {
|
|
|
|
text = Array.prototype.slice.call(arguments).join(" ");
|
|
|
|
}
|
|
|
|
console.log(text);
|
|
|
|
if (typeof Presentation !== "undefined" && typeof Presentation.print === "function") {
|
|
|
|
Presentation.print(text);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
printErr: function printErr(text) {
|
|
|
|
if (arguments.length > 1) {
|
|
|
|
text = Array.prototype.slice.call(arguments).join(" ");
|
|
|
|
}
|
|
|
|
console.error(text);
|
|
|
|
if (typeof Presentation !== "undefined" && typeof Presentation.print === "function") {
|
|
|
|
Presentation.print("**ERROR**:", text)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
canvas: document.getElementById("canvas"),
|
|
|
|
setStatus: function setStatus(text) {
|
|
|
|
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
|
|
|
|
var now = Date.now();
|
|
|
|
if (m) {
|
|
|
|
if (now - Date.now() < 30) // if this is a progress update, skip it if too soon
|
|
|
|
return;
|
|
|
|
text = m[1];
|
|
|
|
}
|
|
|
|
if (typeof Presentation !== "undefined" && typeof Presentation.setStatus == "function") {
|
|
|
|
Presentation.setStatus(text);
|
|
|
|
}
|
2017-01-12 14:14:40 +01:00
|
|
|
}
|
2017-03-28 03:21:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// As a default initial behavior, pop up an alert when WebGL context is lost. To make your
|
|
|
|
// application robust, you may want to override this behavior before shipping!
|
|
|
|
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
|
|
|
|
module.canvas.addEventListener("webglcontextlost", function(e) { alert("WebGL context lost. Plase reload the page."); e.preventDefault(); }, false);
|
|
|
|
|
|
|
|
if (typeof Presentation !== "undefined" && Presentation.postRun instanceof Array) {
|
|
|
|
module.postRun = Presentation.postRun;
|
2017-01-12 14:14:40 +01:00
|
|
|
}
|
2017-03-28 03:21:21 +02:00
|
|
|
|
|
|
|
return module;
|
|
|
|
})();
|
2016-01-20 03:21:29 +01:00
|
|
|
|
2017-01-31 03:46:30 +01:00
|
|
|
if (!Presentation.isWebGL2Available()) {
|
2017-03-28 03:21:21 +02:00
|
|
|
Presentation.setStatus("WebGL 2 appears to be unsupported.\nPlease update browser and drivers.");
|
2017-01-12 14:14:40 +01:00
|
|
|
Presentation.preventLoading = true;
|
|
|
|
} else {
|
|
|
|
Presentation.setStatus("Downloading...");
|
|
|
|
}
|
2016-01-20 03:21:29 +01:00
|
|
|
|
2017-01-12 14:14:40 +01:00
|
|
|
if (Presentation.preventLoading) {
|
|
|
|
// prevent *fs.js and Emscripten's SCRIPT placeholder from loading any files
|
|
|
|
Presentation._XHR_send = XMLHttpRequest.prototype.send;
|
|
|
|
XMLHttpRequest.prototype.send = function() {};
|
|
|
|
Presentation._Node_appendChild = Node.prototype.appendChild;
|
|
|
|
Node.prototype.appendChild = function(node) {
|
|
|
|
if (!(node instanceof HTMLScriptElement)) {
|
|
|
|
return Presentation._Node_appendChild.call(this, node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-20 03:21:29 +01:00
|
|
|
//]]></script>
|
2016-10-30 23:10:17 +01:00
|
|
|
<script type="text/javascript" src="$GODOT_BASEfs.js"></script>
|
2017-01-12 14:14:40 +01:00
|
|
|
{{{ SCRIPT }}}
|
|
|
|
<script type="text/javascript">
|
|
|
|
if (Presentation.preventLoading) {
|
|
|
|
XMLHttpRequest.prototype.send = Presentation._XHR_send;
|
|
|
|
Node.prototype.appendChild = Presentation._Node_appendChild;
|
|
|
|
}
|
|
|
|
</script>
|
2016-01-20 03:21:29 +01:00
|
|
|
</body>
|
2015-09-10 05:10:54 +02:00
|
|
|
</html>
|