added "index.html" file for Emscripten support
authorHolger Schemel <info@artsoft.org>
Thu, 26 Nov 2020 23:19:35 +0000 (00:19 +0100)
committerHolger Schemel <info@artsoft.org>
Thu, 26 Nov 2020 23:19:35 +0000 (00:19 +0100)
build-projects/emscripten/index.html [new file with mode: 0644]

diff --git a/build-projects/emscripten/index.html b/build-projects/emscripten/index.html
new file mode 100644 (file)
index 0000000..cdf397f
--- /dev/null
@@ -0,0 +1,56 @@
+<!doctype html>
+<html lang="en-us">
+<head>
+<meta charset="utf-8"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>Loading Rocks'n'Diamonds</title>
+</head>
+<body style="background:black;text-align:center;vertical-align:middle;">
+<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
+<script type='text/javascript'>
+      var Module = {
+        arguments: [],
+        preRun: [
+          function() {}
+        ],
+        postRun: [],
+        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);
+          };
+        })(),
+        printErr: function(text) {
+          if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
+          if(text.startsWith("[FATAL]")) console.error(text);
+          else console.warn(text);
+        },
+        setStatus: function(text) {/*if(text == '') { document.title = "Rocks'n'Diamonds (stopped)"; } */},
+        quit: (function()
+        {
+          document.title = "Rocks'n'Diamonds (exited)";
+        }),
+        canvas: (function() {
+          var canvas = document.getElementById('canvas');
+
+          // As a default initial behavior, pop up an alert when webgl context is lost. To make your
+          // application robust, you may want to override this behavior before shipping!
+          // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
+          canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
+
+          return canvas;
+        })(),
+        totalDependencies: 0,
+        monitorRunDependencies: function(left) {
+          this.totalDependencies = Math.max(this.totalDependencies, left);
+        }
+      };
+      window.onerror = function(event) {
+        alert("An error occurred, see console.");
+        document.title = "Rocks'n'Diamonds (aborted)";
+      };
+    </script>
+<script async type="text/javascript" src="rocksndiamonds.js"></script>
+</body>
+</html>