]> icculus.org git repositories - taylor/freespace2.git/blob - dist/fs_shell.html
fix incorrect FS2 demo ifdef
[taylor/freespace2.git] / dist / fs_shell.html
1 <!doctype html>
2 <html lang="en-us">
3   <head>
4     <meta charset="utf-8">
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</title>
8     <style>
9       html, body {
10         height: 100%;
11         margin: 0;
12         padding: 0;
13         background-color: #222;
14       }
15       canvas {
16         width: 100vw;
17         height: 75vw;
18         background-color: #000;
19         max-height: 100vh;
20         max-width: 133.333333vh;
21         margin: auto;
22         position: absolute;
23         top: 0;
24         bottom: 0;
25         left: 0;
26         right: 0;
27       }
28     </style>
29   </head>
30   <body>
31     <canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
32     <script type='text/javascript'>
33       var Module = {
34         preRun: [],
35         postRun: [],
36         print: (function() {
37           return function(text) {
38             if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
39             // These replacements are necessary if you render to raw HTML
40             //text = text.replace(/&/g, "&amp;");
41             //text = text.replace(/</g, "&lt;");
42             //text = text.replace(/>/g, "&gt;");
43             //text = text.replace('\n', '<br>', 'g');
44             console.log(text);
45           };
46         })(),
47         printErr: function(text) {
48           if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
49           if (0) { // XXX disabled for safety typeof dump == 'function') {
50             dump(text + '\n'); // fast, straight to the real console
51           } else {
52             console.error(text);
53           }
54         },
55         canvas: (function() {
56           var canvas = document.getElementById('canvas');
57
58           // As a default initial behavior, pop up an alert when webgl context is lost. To make your
59           // application robust, you may want to override this behavior before shipping!
60           // See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
61           canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
62
63           return canvas;
64         })(),
65         setStatus: function(text) {
66         },
67         totalDependencies: 0,
68         monitorRunDependencies: function(left) {
69           this.totalDependencies = Math.max(this.totalDependencies, left);
70           Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
71         }
72       };
73       Module.setStatus('Downloading...');
74       window.onerror = function() {
75         Module.setStatus('Exception thrown, see JavaScript console');
76         Module.setStatus = function(text) {
77           if (text) Module.printErr('[post-exception status] ' + text);
78         };
79       };
80     </script>
81     {{{ SCRIPT }}}
82   </body>
83 </html>