You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
3.0 KiB
HTML
87 lines
3.0 KiB
HTML
<!doctype html>
|
|
<html lang="en-us">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>WebGui Demo</title>
|
|
<style>
|
|
body {
|
|
font-family: arial;
|
|
margin: 0;
|
|
padding: none;
|
|
}
|
|
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
|
|
div.emscripten { text-align: center; }
|
|
div.emscripten_border { border: none; }
|
|
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
|
canvas.emscripten { border: 0px none; background-color: black; }
|
|
#canvas {
|
|
background-color: transparent;
|
|
}
|
|
.container {
|
|
position: relative;
|
|
}
|
|
|
|
.background {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: -1; /* Position behind the canvas */
|
|
}
|
|
|
|
.emscripten_border {
|
|
position: relative;
|
|
z-index: 1; /* Position in front of the background div */
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<div id="backgroundDiv" class="background" style="color: red;">asdf</div>
|
|
<div class="emscripten_border">
|
|
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
|
|
</div>
|
|
</div>
|
|
|
|
<script type='text/javascript'>
|
|
var Module = {
|
|
preRun: [],
|
|
postRun: [],
|
|
print: (function() {})(),
|
|
printErr: function(text) {},
|
|
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) {},
|
|
totalDependencies: 0,
|
|
monitorRunDependencies: function(left) {}
|
|
};
|
|
window.addEventListener('resize', js_resizeCanvas, false);
|
|
function js_resizeCanvas() {
|
|
document.getElementById('canvas').width = window.innerWidth;
|
|
document.getElementById('canvas').height = window.innerHeight;
|
|
}
|
|
function updateBackgroundSize() {
|
|
var canvas = document.getElementById('canvas');
|
|
var backgroundDiv = document.getElementById('backgroundDiv');
|
|
backgroundDiv.style.width = canvas.clientWidth + 'px';
|
|
backgroundDiv.style.height = canvas.clientHeight + 'px';
|
|
}
|
|
|
|
// Update the background div size whenever the canvas size changes.
|
|
window.addEventListener('resize', updateBackgroundSize);
|
|
|
|
// Initial size update.
|
|
updateBackgroundSize();
|
|
|
|
</script>
|
|
<script async type="text/javascript" src="imgui.js"></script>
|
|
</body>
|
|
</html>
|