5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
7 <title>FreeSpace Demo</title>
10 box-sizing: border-box;
19 background-color: #222;
22 background: url(demotitle.jpg);
23 background-repeat: no-repeat;
24 background-size: cover;
35 background-color: #353B4C;
44 background-color: #798199;
46 #progress_text, #progress_bar {
47 font-family: 'Noto Sans', sans-serif;
54 background-color: #000;
56 max-width: 133.333333vh;
68 <div id="progress_container">
69 <div id="progress_bar_back"><div id="progress_bar"></div></div>
70 <div id="progress_text"></div>
73 <canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
74 <script type='text/javascript'>
75 var progress = document.getElementById('progress');
76 var progress_bar = document.getElementById('progress_bar');
77 var progress_text = document.getElementById('progress_text');
83 return function(text) {
84 if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
85 // These replacements are necessary if you render to raw HTML
86 //text = text.replace(/&/g, "&");
87 //text = text.replace(/</g, "<");
88 //text = text.replace(/>/g, ">");
89 //text = text.replace('\n', '<br>', 'g');
93 printErr: function(text) {
94 if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
95 if (0) { // XXX disabled for safety typeof dump == 'function') {
96 dump(text + '\n'); // fast, straight to the real console
101 canvas: (function() {
102 var canvas = document.getElementById('canvas');
104 // As a default initial behavior, pop up an alert when webgl context is lost. To make your
105 // application robust, you may want to override this behavior before shipping!
106 // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
107 canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
111 setStatus: function(text) {
112 if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
113 if (text === Module.setStatus.text) return;
114 var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
117 var perc = parseInt(m[2]) / parseInt(m[4]) * 100;
118 progress_bar.style.width = perc + '%';
119 progress_bar.innerHTML = perc.toFixed(1) + '%';
121 progress_text.innerHTML = text;
123 totalDependencies: 0,
124 monitorRunDependencies: function(left) {
125 this.totalDependencies = Math.max(this.totalDependencies, left);
126 Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
129 Module.setStatus('Downloading...');
130 window.onerror = function() {
131 Module.setStatus('Exception thrown, see JavaScript console');
132 Module.setStatus = function(text) {
133 if (text) Module.printErr('[post-exception status] ' + text);