File: hello_world_gles_shell.html

package info (click to toggle)
emscripten 3.1.69%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 121,872 kB
  • sloc: ansic: 636,110; cpp: 425,974; javascript: 78,401; python: 58,404; sh: 49,154; pascal: 5,237; makefile: 3,365; asm: 2,415; lisp: 1,869
file content (48 lines) | stat: -rw-r--r-- 1,387 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<html>
  <head>
    <title>Emscripten-Generated Code</title>
  <body>
    <center>
      <canvas id='canvas' width='256' height='256'></canvas>
    </center>
    <hr>
    <div id='output'></div>
    <hr>
    <script type='text/javascript' src='fake_events.js'></script>
    <script type='text/javascript'>
      /**
       * TODO: Encapsulate this part in a reusable token such as
       *       EMSCRIPTEN_ENVIRONMENT so that we can share code
       *       between the default shell and custom ones.
       */
      // connect to canvas
      var Module = {
        print: (function() {
          var element = document.getElementById('output');
          return function(text) {
            element.innerHTML += text.replace('\n', '<br>', 'g') + '<br>';
          };
        })(),
        canvas: document.getElementById('canvas')
      };

      // Test code
      async function reportResult(result) {
        await fetch('http://localhost:8888/report_gl_result?' + result);
        window.close();
      }
      function doTest() {
        var firstImage = Module.canvas.toDataURL();
        simulateKeyDown(0x25 /* DOM_VK_LEFT */);
        setTimeout(function() {
          var secondImage = Module.canvas.toDataURL();
          reportResult(firstImage != secondImage);
        }, 500);
      }
      Module.postRun = doTest;

    </script>
    {{{ SCRIPT }}}
  </body>
</html>