mirror of
https://github.com/Bithack/principia.git
synced 2026-06-24 02:04:08 +00:00
68 lines
1.8 KiB
HTML
68 lines
1.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Principia</title>
|
|
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
background: #0f1111;
|
|
color: white;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
margin: auto;
|
|
position: absolute;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<canvas id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
|
|
|
|
<script>
|
|
var Module = {
|
|
preRun: [],
|
|
postRun: [],
|
|
print: function (text) {
|
|
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
|
console.log(text);
|
|
},
|
|
printErr: function (text) {
|
|
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
|
|
console.error(text);
|
|
},
|
|
canvas: (function () { return document.getElementById('canvas'); })(),
|
|
setStatus: function (text) {
|
|
console.log(text);
|
|
},
|
|
totalDependencies: 0,
|
|
monitorRunDependencies: function (left) {
|
|
this.totalDependencies = Math.max(this.totalDependencies, left);
|
|
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies - left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
|
|
}
|
|
};
|
|
|
|
// Read optional `?play=[id]` query parameter and set Module.arguments accordingly
|
|
(function() {
|
|
var params = new URLSearchParams(window.location.search);
|
|
var play = params.get('play');
|
|
if (play && play.length > 0) {
|
|
Module.arguments = ["principia://principia-web.se/play/lvl/db/" + encodeURIComponent(play)];
|
|
}
|
|
})();
|
|
|
|
Module.setStatus('Downloading...');
|
|
window.onerror = function (msg) {
|
|
// TODO: do not warn on ok events like simulating an infinite loop or exitStatus
|
|
Module.setStatus('Exception thrown, see JavaScript console (' + msg + ')');
|
|
Module.setStatus = function (text) {
|
|
if (text) Module.printErr('[post-exception status] ' + text);
|
|
};
|
|
};
|
|
</script>
|
|
<script async src="principia.js"></script>
|
|
</body>
|
|
</html>
|