-
-
Save thomashope/d5b35b89008278b16c1b1482d824db60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<style type="text/css"> | |
* { | |
margin: 0; | |
padding: 0; | |
background-color: #222; | |
} | |
canvas { | |
border: 0px none; | |
outline: none; | |
background-color: black; | |
width: 100%; | |
height: 100%; | |
display: block; | |
margin-left: auto; | |
margin-right: auto; | |
} | |
.overlay { | |
position: absolute; | |
top: 10px; | |
left: 10px; | |
z-index: 1; | |
font-size: 30px; | |
color: white; | |
background-color: black; | |
} | |
</style> | |
</head> | |
<body> | |
<dir class="overlay" id="overlay-text">Loading...</dir> | |
<script type='text/javascript'> | |
var Module = {}; | |
fetch('index.wasm') | |
.then(response => | |
response.arrayBuffer() | |
).then(buffer => { | |
Module.canvas = document.getElementById("canvas"); | |
Module.wasmBinary = buffer; | |
var script = document.createElement('script'); | |
script.src = "index.js"; | |
script.onload = function() { | |
console.log("Emscripten boilerplate loaded.") | |
} | |
document.body.appendChild(script); | |
// When you click outside the canvas on itch.io input stops working, this fixes it | |
Module.canvas.onclick = function() { | |
Module.canvas.focus() | |
} | |
}); | |
Module.setStatus = function(text) { | |
console.log('status:', text); | |
document.getElementById("overlay-text").innerHTML = text; | |
} | |
</script> | |
<canvas id="canvas" tabindex=0></canvas> | |
</body> | |
</html> |
Author
thomashope
commented
Mar 14, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment