mirror of https://github.com/axmolengine/axmol.git
147 lines
6.8 KiB
HTML
147 lines
6.8 KiB
HTML
<!doctype html>
|
|
<html lang="en-us">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>JS_APPLICATION generated by emscripten</title>
|
|
<style>
|
|
body {margin:0px; padding:0px;}
|
|
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
|
|
textarea.emscripten { font-family: monospace; width: 80%; }
|
|
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; }
|
|
#home { position:absolute; width:100%; height:100%; background:#FFF; color: rgb(103, 116, 120); font-family: Tahoma,Arial,sans-serif;}
|
|
#home a{color: rgb(103, 116, 120);}
|
|
#home h1{ text-align:center; padding: 10px; border-radius: 5px 5px 5px 5px; border: 1px solid; background: none repeat scroll 0% 0% rgb(246, 253, 255); border-color: rgb(218, 239, 245); width:250px; margin:10px auto}
|
|
#home div{padding: 10px; border-radius: 5px 5px 5px 5px; border: 1px solid; background: none repeat scroll 0% 0% rgb(246, 253, 255); border-color: rgb(218, 239, 245); width:250px; margin:10px auto}
|
|
#home .error{display: none;}
|
|
#info, #options{padding: 10px; border-radius: 5px 5px 5px 5px; border: 1px solid; background: none repeat scroll 0% 0% rgb(246, 253, 255); border-color: rgb(218, 239, 245); width:600px; margin:10px auto}
|
|
#home img{ display: block; margin: 30px auto; }
|
|
#home h2{ font-size:24px; text-shadow: rgb(255, 255, 255) 0px 1px 0px; margin:0px;}
|
|
#home h3{ font-size:12px; text-shadow: rgb(255, 255, 255) 0px 1px 0px; margin:0px;}
|
|
#home a{ background:rgb(224, 248, 255); border:rgb(195, 242, 255) 1px solid; color:rgb(76, 116, 127); font-size:18px; margin:10px auto 0px auto; border-radius: 5px 5px 5px 5px; padding:3px; text-align:center; text-decoration:none;}
|
|
#home div.error{ border:rgb(255, 226, 195); background:rgb(255, 240, 224); }
|
|
#home .launchButton{ display:none; }
|
|
#home .launchButtonDisabled{ display:block; background:#DDD; border-color:#666; color:#666; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="home">
|
|
<img src="cocos2dx.png" alt="Cocos2d-x" />
|
|
<h1>JS_APPLICATION</h1>
|
|
<div class="emscripten">
|
|
<progress value="0" max="100" id="progress" hidden=1></progress><br />
|
|
<span id="status">Downloading...</span>
|
|
</div>
|
|
<div id="webglerror" class="error">
|
|
<h2>WebGL Error</h2>
|
|
<h3>WebGL is not supported by your browser.</h3>
|
|
</div>
|
|
<div id="highres" class="res">
|
|
<h2>Default quality</h2>
|
|
<a class="launchButtonDisabled">Not ready yet</a>
|
|
<a class="launchButton" href="#" onclick="runApplication();">GO!</a>
|
|
</div>
|
|
</div>
|
|
<div class="emscripten_border">
|
|
<canvas width="1024" height="768" class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
|
|
</div>
|
|
<div class="emscripten" id="options">
|
|
<input type="checkbox" id="resize">Resize canvas
|
|
<input type="checkbox" id="pointerLock" checked>Lock/hide mouse pointer
|
|
|
|
<input type="button" value="Fullscreen" onclick="Module.requestFullScreen(document.getElementById('pointerLock').checked,
|
|
document.getElementById('resize').checked)">
|
|
</div>
|
|
|
|
<textarea class="emscripten" id="output" rows="8"></textarea>
|
|
<script type='text/javascript'>
|
|
var Module = {
|
|
preRun: [],
|
|
postRun: [],
|
|
print: (function() {
|
|
var element = document.getElementById('output');
|
|
element.value = ''; // clear browser cache
|
|
return function(text) {
|
|
text = Array.prototype.slice.call(arguments).join(' ');
|
|
element.value += text + "\n";
|
|
element.scrollTop = 99999; // focus on bottom
|
|
};
|
|
})(),
|
|
printErr: function(text) {
|
|
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(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 = progressElement.max;
|
|
//progressElement.value = null;
|
|
//progressElement.max = null;
|
|
//progressElement.hidden = true;
|
|
//statusElement.hidden = true;
|
|
}
|
|
statusElement.innerHTML = text;
|
|
},
|
|
totalDependencies: 0,
|
|
monitorRunDependencies: function(left) {
|
|
this.totalDependencies = Math.max(this.totalDependencies, left);
|
|
if(left)
|
|
Module.setStatus('Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')');
|
|
else if(this.totalDependencies > 1) {
|
|
Module.setStatus('All downloads completed');
|
|
onResourcesLoaded();
|
|
}
|
|
}
|
|
};
|
|
|
|
function loadScript(filename){
|
|
Module.setStatus('Downloading... ' + filename);
|
|
var fileref=document.createElement('script')
|
|
fileref.setAttribute("type","text/javascript")
|
|
fileref.setAttribute("src", filename);
|
|
if (typeof fileref != "undefined")
|
|
document.getElementsByTagName("head")[0].appendChild(fileref)
|
|
}
|
|
|
|
function runApplication(width){
|
|
document.getElementById('home').style.visibility = 'hidden';
|
|
Module.callMain();
|
|
}
|
|
|
|
function onResourcesLoaded(){
|
|
var buttons = document.getElementsByClassName("launchButton");
|
|
Array.prototype.forEach.call(buttons, function(button) { button.style.display = 'block'; });
|
|
|
|
var buttonsDisabled = document.getElementsByClassName("launchButtonDisabled");
|
|
Array.prototype.forEach.call(buttonsDisabled, function(button) { button.style.display = 'none'; });
|
|
}
|
|
|
|
function onDocumentLoaded(){
|
|
if(!window.WebGLRenderingContext){
|
|
document.getElementById("webglerror").style.display = 'block';
|
|
return;
|
|
}
|
|
loadScript("JS_APPLICATION.js");
|
|
loadScript("JS_APPLICATION.data.js");
|
|
}
|
|
|
|
onDocumentLoaded();
|
|
</script>
|
|
</body>
|
|
</html>
|