<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Spider Game</title> <style> body { font-family: arial; margin: 0; padding: none; background-color: black; } .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; } div.emscripten { text-align: center; } /* the canvas *must not* have any border or padding, or mouse coords will be wrong */ canvas.emscripten { border: 0px none; background-color: black; } #status { display: block; vertical-align: top; margin-top: 5px; margin-left: auto; margin-right: auto; font-weight: bold; color: rgb(120, 120, 120); background-color: white; } #progress { height: 20px; width: 30px; background-color: white; } #goodbye { background-color: white; margin-bottom: 15px; } #errors { background-color: white; margin-bottom: 15px; } </style> </head> <body> <div class="emscripten" id="status">Downloading...</div> <div class="emscripten"> <progress value="0" max="100" id="progress" hidden=1></progress> </div> <div class="emscripten_border"> <div class="emscripten" id="errors" style="display: none"> <h2>Exited with errors:</h2> <textarea id="errOutput" rows=20 cols=80></textarea> </div> <div class="emscripten" id="goodbye" style="display: none"> <h2>Thanks for playing!</h2> <a href="/">Back to homepage</a> </div> <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas> </div> <script type='text/javascript'> var statusElement = document.getElementById('status'); var progressElement = document.getElementById('progress'); var Module = { arguments: [], preRun: [], postRun: [], onExit: function(exitCode) { var canvas = document.getElementById('canvas'); var goodbye = document.getElementById('goodbye'); var errors = document.getElementById('errors'); if (exitCode == 0) { // NOTE: don't try canvas.getContext('2d'), because it might return null, // because Emscripten may already have called it with a different context // type, e.g. canvas.getContext('webgl') // ...so instead, we just hide it. :P canvas.style.display = 'none'; goodbye.style.display = ''; } else { errors.style.display = ''; } }, 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(' '); // These replacements are necessary if you render to raw HTML //text = text.replace(/&/g, "&"); //text = text.replace(/</g, "<"); //text = text.replace(/>/g, ">"); //text = text.replace('\n', '<br>', 'g'); console.log(text); if (element) { element.value += text + "\n"; element.scrollTop = element.scrollHeight; // focus on bottom } }; })(), printErr: (function() { var element = document.getElementById('errOutput'); if (element) element.value = ''; // clear browser cache return function(text) { if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); if (0) { // XXX disabled for safety typeof dump == 'function') { dump(text + '\n'); // fast, straight to the real console } else { // console.log instead of console.error, because in C we use stderr // for general logging, not just for errors. console.log(text); if (element) { element.value += text + "\n"; element.scrollTop = element.scrollHeight; // focus on bottom } } }; })(), 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; })(), setStatus: function(text) { if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' }; if (text === Module.setStatus.text) return; var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/); var now = Date.now(); if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon if (m) { text = m[1]; progressElement.value = parseInt(m[2])*100; progressElement.max = parseInt(m[4])*100; progressElement.hidden = false; } else { progressElement.value = null; progressElement.max = null; progressElement.hidden = true; } statusElement.innerHTML = text; }, totalDependencies: 0, monitorRunDependencies: function(left) { this.totalDependencies = Math.max(this.totalDependencies, left); Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.'); } }; Module.setStatus('Downloading...'); window.onerror = function(event) { // TODO: do not warn on ok events like simulating an infinite loop or exitStatus //Module.setStatus('Exception thrown, see JavaScript console'); //Module.setStatus = function(text) { // if (text) Module.printErr('[post-exception status] ' + text); //}; }; </script> <script> var ASSERTIONS = 0; // Prefix of data URIs emitted by SINGLE_FILE and related options. var dataURIPrefix = 'data:application/octet-stream;base64,'; // Indicates whether filename is a base64 data URI. function isDataURI(filename) { return String.prototype.startsWith ? filename.startsWith(dataURIPrefix) : filename.indexOf(dataURIPrefix) === 0; } // Copied from https://github.com/strophe/strophejs/blob/e06d027/src/polyfills.js#L149 // This code was written by Tyler Akins and has been placed in the // public domain. It would be nice if you left this header intact. // Base64 code from Tyler Akins -- http://rumkin.com /** * Decodes a base64 string. * @param {String} input The string to decode. */ var decodeBase64 = typeof atob === 'function' ? atob : function (input) { var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var output = ''; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; // remove all characters that are not A-Z, a-z, 0-9, +, /, or = input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); do { enc1 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++)); enc4 = keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 !== 64) { output = output + String.fromCharCode(chr2); } if (enc4 !== 64) { output = output + String.fromCharCode(chr3); } } while (i < input.length); return output; }; // Converts a string of base64 into a byte array. // Throws error on invalid input. function intArrayFromBase64(s) { if (typeof ENVIRONMENT_IS_NODE === 'boolean' && ENVIRONMENT_IS_NODE) { var buf; try { buf = Buffer.from(s, 'base64'); } catch (_) { buf = new Buffer(s, 'base64'); } return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); } try { var decoded = decodeBase64(s); var bytes = new Uint8Array(decoded.length); for (var i = 0 ; i < decoded.length ; ++i) { bytes[i] = decoded.charCodeAt(i); } return bytes; } catch (_) { throw new Error('Converting base64 string to bytes failed.'); } } // If filename is a base64 data URI, parses and returns data (Buffer on node, // Uint8Array otherwise). If filename is not a base64 data URI, returns undefined. function tryParseAsDataURI(filename) { if (!isDataURI(filename)) { return; } return intArrayFromBase64(filename.slice(dataURIPrefix.length)); } /** @type {function(string, boolean=, number=)} */ function intArrayFromString(stringy, dontAddNull, length) { var len = length > 0 ? length : lengthBytesUTF8(stringy)+1; var u8array = new Array(len); var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); if (dontAddNull) u8array.length = numBytesWritten; return u8array; } function intArrayToString(array) { var ret = []; for (var i = 0; i < array.length; i++) { var chr = array[i]; if (chr > 0xFF) { if (ASSERTIONS) { assert(false, 'Character code ' + chr + ' (' + String.fromCharCode(chr) + ') at offset ' + i + ' not in 0x00-0xFF.'); } chr &= 0xFF; } ret.push(String.fromCharCode(chr)); } return ret.join(''); } var memoryInitializer = 'main.html.mem'; if (typeof Module['locateFile'] === 'function') { memoryInitializer = Module['locateFile'](memoryInitializer); } else if (Module['memoryInitializerPrefixURL']) { memoryInitializer = Module['memoryInitializerPrefixURL'] + memoryInitializer; } Module['memoryInitializerRequestURL'] = memoryInitializer; var meminitXHR = Module['memoryInitializerRequest'] = new XMLHttpRequest(); meminitXHR.open('GET', memoryInitializer, true); meminitXHR.responseType = 'arraybuffer'; meminitXHR.send(null); var script = document.createElement('script'); script.src = "main.js"; document.body.appendChild(script); </script> </body> </html>