HTMLshell.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!doctype html>
  2. <!--
  3. HTML template for the emscripten page. Unlike emscipten's official minimal
  4. frontend, this one is really minimal.
  5. by Miloslav Ciz (drummyfish), 2020
  6. Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
  7. plus a waiver of all other intellectual property. The goal of this work is
  8. be and remain completely in the public domain forever, available for any use
  9. whatsoever.
  10. -->
  11. <html>
  12. <head>
  13. <meta charset="utf-8">
  14. <title>game</title>
  15. <style>
  16. table
  17. {
  18. width: 100%;
  19. }
  20. td
  21. {
  22. width: 11%;
  23. padding: 0;
  24. margin: 0;
  25. }
  26. button
  27. {
  28. width: 100%;
  29. }
  30. canvas
  31. {
  32. display: block;
  33. margin: 10px auto 30px;
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
  39. <script type='text/javascript'>
  40. Module = {
  41. print:
  42. function(what)
  43. {
  44. console.log(what);
  45. },
  46. printErr:
  47. function(what)
  48. {
  49. console.error(what);
  50. },
  51. canvas:
  52. (
  53. function()
  54. {
  55. return document.getElementById('canvas');
  56. }
  57. )(),
  58. onRuntimeInitialized: function()
  59. {
  60. pressFunc = Module.cwrap('webButton', '', ['number','number']);
  61. }
  62. };
  63. function down(button)
  64. {
  65. pressFunc(button,1);
  66. }
  67. function up(button)
  68. {
  69. pressFunc(button,0);
  70. }
  71. </script>
  72. {{{ SCRIPT }}}
  73. <table style="user-select:none; -moz-user-select: none; -ms-user-select:none; -webkit-user-select: none; -o-user-select:none;" onselectstart="return false;" unselectable="on">
  74. <tr> <td></td> <td><button onmousedown="down(0)" ontouchstart="down(0)" onmouseup="up(0)" ontouchend="up(0)" onmouseout="up(0)" ontouchleave="(0)">U</button></td> <td></td> <td></td> <td><button onmousedown="down(4)" ontouchstart="down(4)" onmouseup="up(4)" ontouchend="up(4)" onmouseout="up(4)" ontouchleave="(4)">A</button></td> <td></td> <td></td> </tr>
  75. <tr> <td><button onmousedown="down(3)" ontouchstart="down(3)" onmouseup="up(3)" ontouchend="up(3)" onmouseout="up(3)" ontouchleave="(3)">L</button></td> <td></td> <td><button onmousedown="down(1)" ontouchstart="down(1)" onmouseup="up(1)" ontouchend="up(1)" onmouseout="up(1)" ontouchleave="(1)">R</button></td> <td></td> <td></td> <td><button onmousedown="down(5)" ontouchstart="down(5)" onmouseup="up(5)" ontouchend="up(5)" onmouseout="up(5)" ontouchleave="(5)">B</button></td> <td></td> </tr>
  76. <tr> <td></td> <td><button onmousedown="down(2)" ontouchstart="down(2)" onmouseup="up(2)" ontouchend="up(2)" onmouseout="up(2)" ontouchleave="(2)">D</button></td> <td></td> <td></td> <td></td> <td></td> <td><button onmousedown="down(6)" ontouchstart="down(6)" onmouseup="up(6)" ontouchend="up(6)" onmouseout="up(6)" ontouchleave="(6)">C</button></td> </tr>
  77. </table>
  78. </body>
  79. </html>