D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
rayfrye
Full window
Github gist
unity index.html file - edited to change focus to unity game in iframe when clicked. otherwise keyboard input won't work.
<!doctype html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Unity WebGL Player | 2DRPG</title> <link rel="stylesheet" href="TemplateData/style.css"> <link rel="shortcut icon" href="TemplateData/favicon.ico" /> <script src="TemplateData/UnityProgress.js"></script> </head> <body class="template"> <p class="header"><span>Unity WebGL Player | </span>2DRPG</p> <div class="template-wrap clear"> <canvas onclick="window.focus()" class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" height="600px" width="960px"></canvas> <div class="logo"></div> <div class="fullscreen"><img src="TemplateData/fullscreen.png" width="38" height="38" alt="Fullscreen" title="Fullscreen" onclick="SetFullscreen(1);" /></div> <div class="title">2DRPG</div> </div> <p class="footer">« created with <a href="https://unity3d.com/" title="Go to unity3d.com">Unity</a> »</p> <style> * { margin: 20; padding: 20; } html, body { width: 100vw; height: 100vh; } canvas { height: 90vh; width: 90vw; display: block; } </style> <script type='text/javascript'> window.onload = function() { window.focus(); } // connect to canvas var Module = { TOTAL_MEMORY: 268435456, filePackagePrefixURL: "Development/", memoryInitializerPrefixURL: "Development/", preRun: [], postRun: [], print: (function() { return function(text) { console.log (text); }; })(), printErr: function(text) { console.error (text); }, canvas: document.getElementById('canvas'), progress: null, setStatus: function(text) { if (this.progress == null) { if (typeof UnityProgress != 'function') return; this.progress = new UnityProgress (canvas); } if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' }; if (text === Module.setStatus.text) return; this.progress.SetMessage (text); var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/); if (m) this.progress.SetProgress (parseInt(m[2])/parseInt(m[4])); if (text === "") this.progress.Clear() }, 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 (0.0/1)'); </script> <script src="Development/UnityConfig.js"></script> <script src="Development/fileloader.js"></script> <script>if (!(!Math.fround)) { var script = document.createElement('script'); script.src = "Development/webglbuild.js"; document.body.appendChild(script); } else { var codeXHR = new XMLHttpRequest(); codeXHR.open('GET', 'Development/webglbuild.js', true); codeXHR.onload = function() { var code = codeXHR.responseText; if (!Math.fround) { console.log('optimizing out Math.fround calls'); code = code.replace(/Math_fround\(/g, '(').replace("'use asm'", "'almost asm'") } var blob = new Blob([code], { type: 'text/javascript' }); codeXHR = null; var src = URL.createObjectURL(blob); var script = document.createElement('script'); script.src = URL.createObjectURL(blob); script.onload = function() { URL.revokeObjectURL(script.src); }; document.body.appendChild(script); }; codeXHR.send(null); } </script> </body> </html>