forked from tas/major_tom
99 lines
2.7 KiB
HTML
99 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Jump 'n Run</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
background: #1a1a2e;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 100vh;
|
|
font-family: monospace;
|
|
color: #e0e0e0;
|
|
}
|
|
#canvas-container {
|
|
position: relative;
|
|
border: 2px solid #333;
|
|
background: #000;
|
|
}
|
|
canvas.emscripten {
|
|
display: block;
|
|
image-rendering: pixelated;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
#status {
|
|
margin-top: 12px;
|
|
font-size: 14px;
|
|
color: #888;
|
|
}
|
|
#progress-bar {
|
|
width: 320px;
|
|
height: 6px;
|
|
background: #333;
|
|
border-radius: 3px;
|
|
margin-top: 8px;
|
|
overflow: hidden;
|
|
}
|
|
#progress-bar-inner {
|
|
height: 100%;
|
|
width: 0%;
|
|
background: #4ecdc4;
|
|
transition: width 0.2s;
|
|
}
|
|
.hidden { display: none !important; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="canvas-container">
|
|
<canvas class="emscripten" id="canvas" tabindex="1"
|
|
width="640" height="360"></canvas>
|
|
</div>
|
|
<div id="status">Loading...</div>
|
|
<div id="progress-bar"><div id="progress-bar-inner"></div></div>
|
|
|
|
<script>
|
|
var statusEl = document.getElementById('status');
|
|
var progressEl = document.getElementById('progress-bar');
|
|
var progressIn = document.getElementById('progress-bar-inner');
|
|
|
|
var Module = {
|
|
canvas: document.getElementById('canvas'),
|
|
print: function(text) { console.log(text); },
|
|
printErr: function(text) { console.error(text); },
|
|
setStatus: function(text) {
|
|
if (!text) {
|
|
statusEl.classList.add('hidden');
|
|
progressEl.classList.add('hidden');
|
|
return;
|
|
}
|
|
/* Parse "Downloading data... (X/Y)" progress messages */
|
|
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
|
|
if (m) {
|
|
var pct = (parseInt(m[2]) / parseInt(m[4])) * 100;
|
|
progressIn.style.width = pct + '%';
|
|
}
|
|
statusEl.textContent = text;
|
|
},
|
|
totalDependencies: 0,
|
|
monitorRunDependencies: function(left) {
|
|
this.totalDependencies = Math.max(this.totalDependencies, left);
|
|
Module.setStatus(left
|
|
? 'Loading... (' + (this.totalDependencies - left) + '/' + this.totalDependencies + ')'
|
|
: '');
|
|
}
|
|
};
|
|
|
|
Module.setStatus('Loading...');
|
|
window.onerror = function() {
|
|
Module.setStatus('Error - check the browser console');
|
|
};
|
|
</script>
|
|
{{{ SCRIPT }}}
|
|
</body>
|
|
</html>
|