1
0
Fork 0
forked from fte/fteqw
fteqw/engine/web/fteshell.html
Spoike e8c0014b58 fix .gravity on non-players.
try to fix webgl's mouse cursors on misaligned canvases.
fix q2 tent issue.
fix bmp screenshots.
allow disabling packages via renaming, instead of only deleting.
support negative dlights.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5133 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-07-31 17:15:37 +00:00

88 lines
No EOL
3.2 KiB
HTML

<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name=viewport content="width=device-width, initial-scale=1">
<title>FTE QuakeWorld</title>
<style>
html,body { background-color:#000000; color:#808080; height:100%;width:100%;margin:0;padding:0;}
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
div.emscripten { text-align: center; padding:0; margin: 0;}
div.emscripten_border { padding:0; margin: 0; width:100%; height: 100%;}
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { border: 0px none; width:100%; height:100%; padding:0; margin: 0;}
</style>
</head>
<body>
<div class="emscripten" id="status">Is javascript enabled?</div>
<div class="emscripten">
<progress value="0" max="100" id="progress" hidden=1></progress>
</div>
<div class="emscripten_border">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
</div>
<script type='text/javascript'>
// connect to canvas
var Module = {
// preRun: [],
postRun: [function()
{
if (Module["sched"] === undefined) //if this happens then our main function failed to set up the main loop. ie: main didn't get called.
alert("Unable to initialise. You may need to restart your browser. If you get this often and inconsistently, consider using a 64bit browser instead.");
}],
print: function(msg)
{
console.log(msg);
},
printErr: function(text)
{
//this is infuriating as hell.
//emscripten is a piece of shit for actual released work.
if (text.substr(0, 28) == "Cannot enlarge memory arrays")
alert("Memory full/fragmented. Please reload the page.");
else
console.log(text);
},
canvas: document.getElementById('canvas'),
setStatus: function(text)
{
if (Module.setStatus.interval)
clearInterval(Module.setStatus.interval);
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var statusElement = document.getElementById('status');
var progressElement = document.getElementById('progress');
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...');
// make a script
var s = document.createElement('script');
// set it up
s.setAttribute('src',"ftewebgl.js");
s.setAttribute('type',"text/javascript");
s.setAttribute('charset',"utf-8");
s.addEventListener('error', function() {alert("Oh noes! we got an error!");}, false);
// add to DOM
document.head.appendChild(s);
</script>
</body>
</html>