imgui

FORK: Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
git clone https://git.neptards.moe/neptards/imgui.git
Log | Files | Refs

index.html (2650B)


      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+WebGPU example</title>
      7     <style>
      8         body { margin: 0; background-color: black }
      9         .emscripten {
     10             position: absolute;
     11             top: 0px;
     12             left: 0px;
     13             margin: 0px;
     14             border: 0;
     15             width: 100%;
     16             height: 100%;
     17             overflow: hidden;
     18             display: block;
     19             image-rendering: optimizeSpeed;
     20             image-rendering: -moz-crisp-edges;
     21             image-rendering: -o-crisp-edges;
     22             image-rendering: -webkit-optimize-contrast;
     23             image-rendering: optimize-contrast;
     24             image-rendering: crisp-edges;
     25             image-rendering: pixelated;
     26             -ms-interpolation-mode: nearest-neighbor;
     27         }
     28     </style>
     29   </head>
     30   <body>
     31     <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
     32     <script type='text/javascript'>
     33       var Module;
     34       (async () => {
     35         Module = {
     36           preRun: [],
     37           postRun: [],
     38           print: (function() {
     39               return function(text) {
     40                   text = Array.prototype.slice.call(arguments).join(' ');
     41                   console.log(text);
     42               };
     43           })(),
     44           printErr: function(text) {
     45               text = Array.prototype.slice.call(arguments).join(' ');
     46               console.error(text);
     47           },
     48           canvas: (function() {
     49               var canvas = document.getElementById('canvas');
     50               //canvas.addEventListener("webglcontextlost", function(e) { alert('FIXME: WebGL context lost, please reload the page'); e.preventDefault(); }, false);
     51               return canvas;
     52           })(),
     53           setStatus: function(text) {
     54               console.log("status: " + text);
     55           },
     56           monitorRunDependencies: function(left) {
     57               // no run dependencies to log
     58           }
     59         };
     60         window.onerror = function() {
     61           console.log("onerror: " + event);
     62         };
     63 
     64       // Initialize the graphics adapter
     65       {
     66           const adapter = await navigator.gpu.requestAdapter();
     67           const device = await adapter.requestDevice();
     68           Module.preinitializedWebGPUDevice = device;
     69       }
     70 
     71       {
     72           const js = document.createElement('script');
     73           js.async = true;
     74           js.src = "index.js";
     75           document.body.appendChild(js);
     76       }
     77       })();
     78     </script>
     79   </body>
     80 </html>