Graphoon/index.html

110 lines
3.7 KiB
HTML
Raw Normal View History

2016-02-07 19:28:38 +00:00
2016-02-07 19:36:12 +00:00
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Graphoon</title>
<style>
body {
font-family: arial;
margin: 0;
padding: none;
background-color: rgb( 224, 244, 252 );
color: rgb( 28, 78, 104 );
}
footer {
font-family: arial;
font-size: 12px;
padding-left: 10px;
position:absolute;
bottom: 0;
width: 100%;
}
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
#canvas {
padding-right: 0;
display: none;
border: 0px none;
background-color: rgb( 224, 244, 252 );
color: rgb( 28, 78, 104 );
}
</style>
</head>
<body>
<center>
<div>
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<canvas id="loadingCanvas" oncontextmenu="event.preventDefault()" width="800" height="600"></canvas>
</div>
</center>
<script type='text/javascript'>
window.addEventListener("keydown", function(e) {
// space and arrow keys
if([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
e.preventDefault();
}
}, false);
var loadingContext = document.getElementById('loadingCanvas').getContext('2d');
function drawLoadingText(text) {
var canvas = loadingContext.canvas;
loadingContext.fillStyle = 'white';
loadingContext.fillRect(0, 0, canvas.scrollWidth, canvas.scrollHeight);
loadingContext.font = '2em arial';
loadingContext.textAlign = 'center'
loadingContext.fillStyle = 'black';
loadingContext.fillText(text, canvas.scrollWidth / 2, canvas.scrollHeight / 2);
}
var Module = {
arguments: ['./'],
printErr: console.error.bind(console),
canvas: (function() {
var canvas = document.getElementById('canvas');
// 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);
return canvas;
})(),
setStatus: function(text) {
if (text) {
drawLoadingText(text);
} else {
document.getElementById('loadingCanvas').style.display = 'none';
document.getElementById('canvas').style.display = 'block';
}
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
};
Module.setStatus('Downloading...');
window.onerror = function(event) {
// 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) {
if (text) Module.printErr('[post-exception status] ' + text);
};
};
</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> - Fork me on <a href="https://github.com/rm-code/Graphoon">github</a>!</p>
</footer>
</body>
2016-02-07 19:28:38 +00:00
</html>