| 1 | <!doctype html> |
| 2 | <html lang="en-us"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/> |
| 6 | <title>Dear ImGui Emscripten example</title> |
| 7 | <style> |
| 8 | body { margin: 0; background-color: black; overflow: hidden; } |
| 9 | /* FIXME: with our GLFW example this block seems to break resizing and io.DisplaySize gets stuck */ |
| 10 | .emscripten { |
| 11 | position: absolute; |
| 12 | top: 0px; |
| 13 | left: 0px; |
| 14 | margin: 0px; |
| 15 | border: 0; |
| 16 | width: 100%; |
| 17 | height: 100%; |
| 18 | overflow: hidden; |
| 19 | display: block; |
| 20 | image-rendering: optimizeSpeed; |
| 21 | image-rendering: -moz-crisp-edges; |
| 22 | image-rendering: -o-crisp-edges; |
| 23 | image-rendering: -webkit-optimize-contrast; |
| 24 | image-rendering: optimize-contrast; |
| 25 | image-rendering: crisp-edges; |
| 26 | image-rendering: pixelated; |
| 27 | -ms-interpolation-mode: nearest-neighbor; |
| 28 | } |
| 29 | #canvas:focus { |
| 30 | outline: none; |
| 31 | } |
| 32 | </style> |
| 33 | </head> |
| 34 | <body> |
| 35 | <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas> |
| 36 | <script type='text/javascript'> |
| 37 | var Module = { |
| 38 | preRun: [], |
| 39 | postRun: [], |
| 40 | print: (function() { |
| 41 | return function(text) { |
| 42 | text = Array.prototype.slice.call(arguments).join(' '); |
| 43 | console.log(text); |
| 44 | }; |
| 45 | })(), |
| 46 | printErr: function(text) { |
| 47 | text = Array.prototype.slice.call(arguments).join(' '); |
| 48 | console.error(text); |
| 49 | }, |
| 50 | canvas: (function() { |
| 51 | var canvas = document.getElementById('canvas'); |
| 52 | //canvas.addEventListener("webglcontextlost", function(e) { alert('FIXME: WebGL context lost, please reload the page'); e.preventDefault(); }, false); |
| 53 | return canvas; |
| 54 | })(), |
| 55 | setStatus: function(text) { |
| 56 | console.log("status: " + text); |
| 57 | }, |
| 58 | monitorRunDependencies: function(left) { |
| 59 | // no run dependencies to log |
| 60 | } |
| 61 | }; |
| 62 | window.onerror = function() { |
| 63 | console.log("onerror: " + event); |
| 64 | }; |
| 65 | </script> |
| 66 | {{{ SCRIPT }}} |
| 67 | </body> |
| 68 | </html> |