Graphoon/index.html

91 lines
3.6 KiB
HTML
Raw Normal View History

2016-02-07 19:36:12 +00:00
<!doctype html>
<html lang="en-us">
2016-03-14 09:53:34 +00:00
<head>
2016-02-07 19:36:12 +00:00
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2016-03-14 09:53:34 +00:00
<title>Game Title</title>
2016-02-07 19:36:12 +00:00
2016-03-14 09:53:34 +00:00
<!-- Load custom style sheet -->
<link rel="stylesheet" type="text/css" href="theme/love.css">
</head>
<body>
2016-02-07 19:36:12 +00:00
<center>
2016-03-14 09:53:34 +00:00
<div>
<h1>Game Title</h1>
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<canvas id="loadingCanvas" oncontextmenu="event.preventDefault()" width="800" height="600"></canvas>
</div>
2016-02-07 19:36:12 +00:00
</center>
<script type='text/javascript'>
2016-03-14 09:53:34 +00:00
var loadingContext = document.getElementById('loadingCanvas').getContext('2d');
function drawLoadingText(text) {
2016-02-07 19:36:12 +00:00
var canvas = loadingContext.canvas;
2016-03-14 09:53:34 +00:00
loadingContext.fillStyle = "rgb(142, 195, 227)";
2016-02-07 19:36:12 +00:00
loadingContext.fillRect(0, 0, canvas.scrollWidth, canvas.scrollHeight);
loadingContext.font = '2em arial';
loadingContext.textAlign = 'center'
2016-03-14 09:53:34 +00:00
loadingContext.fillStyle = "rgb( 11, 86, 117 )";
2016-02-07 19:36:12 +00:00
loadingContext.fillText(text, canvas.scrollWidth / 2, canvas.scrollHeight / 2);
2016-03-14 09:53:34 +00:00
loadingContext.fillText("Powered By Emscripten.", canvas.scrollWidth / 2, canvas.scrollHeight / 4);
loadingContext.fillText("Powered By LÖVE.", canvas.scrollWidth / 2, canvas.scrollHeight / 4 * 3);
}
window.addEventListener("keydown", function(e) {
// space and arrow keys
if([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
e.preventDefault();
}
}, false);
var Module = {
2016-02-07 19:36:12 +00:00
arguments: ['./'],
printErr: console.error.bind(console),
canvas: (function() {
2016-03-14 09:53:34 +00:00
var canvas = document.getElementById('canvas');
2016-02-07 19:36:12 +00:00
2016-03-14 09:53:34 +00: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
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
2016-02-07 19:36:12 +00:00
2016-03-14 09:53:34 +00:00
return canvas;
2016-02-07 19:36:12 +00:00
})(),
setStatus: function(text) {
2016-03-14 09:53:34 +00:00
if (text) {
drawLoadingText(text);
} else if (Module.didSyncFS && Module.remainingDependencies === 0) {
Module.callMain(Module.arguments);
document.getElementById('loadingCanvas').style.display = 'none';
document.getElementById('canvas').style.display = 'block';
}
2016-02-07 19:36:12 +00:00
},
2016-03-14 09:53:34 +00:00
didSyncFS: false,
2016-02-07 19:36:12 +00:00
totalDependencies: 0,
2016-03-14 09:53:34 +00:00
remainingDependencies: 0,
2016-02-07 19:36:12 +00:00
monitorRunDependencies: function(left) {
2016-03-14 09:53:34 +00:00
this.remainingDependencies = left;
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
2016-02-07 19:36:12 +00:00
}
2016-03-14 09:53:34 +00:00
};
Module.setStatus('Downloading...');
window.onerror = function(event) {
2016-02-07 19:36:12 +00:00
// TODO: do not warn on ok events like simulating an infinite loop or exitStatus
Module.setStatus('Exception thrown, see JavaScript console');
Module.setStatus = function(text) {
2016-03-14 09:53:34 +00:00
if (text) Module.printErr('[post-exception status] ' + text);
2016-02-07 19:36:12 +00:00
};
2016-03-14 09:53:34 +00:00
};
</script>
<script type="text/javascript" src="game.js"></script>
<script async type="text/javascript" src="love.js"></script>
<footer>
<p>Built with <a href="https://github.com/TannerRogalsky/love.js">love.js</a></p>
</footer>
</body>
2016-02-07 19:28:38 +00:00
</html>