Codename Hamster - For olcCodeJam 2024
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hamster/emscripten_shell.html

89 lines
2.3 KiB

<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hamster</title>
<style>
html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
body {
font-family: arial;
background: #222;
color: #ded;
overflow: hidden;
display: flex;
align-items: center;
justify-items: center;
justify-content: center;
}
.light {
background: #fff;
color: #000;
}
#container {
position: fixed;
display: flex;
justify-content: center;
align-items: center;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
#canvas {
display: block;
border: 0px none;
background-color: black;
margin: 0 auto;
}
#canvas:focus {
outline: none;
}
</style>
</head>
<body>
<div id="container">
<canvas id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
</div>
<script type='text/javascript'>
var Module = {
print: (function () {
return (...args) => {
var text = args.join(' ');
console.log(text);
};
})(),
canvas: (() => {
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", (e) => { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
setStatus: (text) => {
},
totalDependencies: 0,
monitorRunDependencies: (left) => {
}
};
</script>
{{{ SCRIPT }}}
</body>
</html>