Sha256: 27499267f08940a1009b87af3d791837c407d8921428a516f0ea3a34e5006ebe

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Ruby 2D</title>
    <style>
      body {
        font-family: system-ui;
      }

      hr {
        border: none;
        height: 3px;
        margin: 15px 0;
        background-color: lightgray;
      }

      #canvas {
        display: block;
        margin: 0 auto;
      }

      #output {
        display: block;
        box-sizing: border-box;
        width: 100%;
        height: 300px;
        padding: 10px;
        font-size: 14px;
        font-family: monospace;
        color: white;
        border: none;
        background-color: black;
      }
    </style>
  </head>
  <body>
    <h1>Ruby 2D</h1>
    <p>This is a sample HTML template, but you can create your own!</p>
    <hr>
    <canvas id="canvas" oncontextmenu=".preventDefault()"></canvas>
    <h2 style="margin-bottom: 0;">Output</h2>
    <p style="margin: 4px 0 8px 0">Open the JavaScript console in developer tools for more detail.</p>
    <textarea id="output"></textarea>
  </body>

  <script>
    var Module = {
      canvas: (function() { return document.getElementById('canvas'); })(),
      print: (function() {
        var element = document.getElementById('output');
        if (element) element.value = '';  // clear browser cache
        return function(text) {
          if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
          console.log(text);
          if (element) {
            element.value += text + "\n";
            element.scrollTop = element.scrollHeight;  // focus on bottom
          }
        };
      })()
    };
  </script>
  <script async src="app.js"></script>
</html>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby2d-0.12.1 assets/wasm/template.html
ruby2d-0.12.0 assets/wasm/template.html