Commit e12fd116 authored by cvet's avatar cvet

Web build index.html patching.

git-svn-id: https://xp-dev.com/svn/fonline_sdk@772 71b6ff52-6597-447a-9a87-58edf7a03249
parent 1ee27eb0
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Emscripten-Generated Code</title> <title>$TITLE$</title>
<style> <style>
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; } .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
textarea.emscripten { font-family: monospace; width: 80%; } textarea.emscripten { font-family: monospace; width: 80%; }
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</head> </head>
<body> <body>
<hr/> <hr/>
<figure style="overflow:visible;" id="spinner"><div class="spinner"></div><center style="margin-top:0.5em"><strong>emscripten</strong></center></figure> <figure style="overflow:visible;" id="spinner"><div class="spinner"></div><center style="margin-top:0.5em"><strong>$LOADING$</strong></center></figure>
<div class="emscripten" id="status">Downloading...</div> <div class="emscripten" id="status">Downloading...</div>
<div class="emscripten"> <div class="emscripten">
<progress value="0" max="100" id="progress" hidden=1></progress> <progress value="0" max="100" id="progress" hidden=1></progress>
...@@ -58,11 +58,7 @@ ...@@ -58,11 +58,7 @@
</div> </div>
<hr/> <hr/>
<div class="emscripten"> <div class="emscripten">
<input type="checkbox" id="resize">Resize canvas <input type="button" value="Fullscreen" onclick="Module.requestFullScreen(true, false)">
<input type="checkbox" id="pointerLock" checked>Lock/hide mouse pointer
&nbsp;&nbsp;&nbsp;
<input type="button" value="Fullscreen" onclick="Module.requestFullScreen(document.getElementById('pointerLock').checked,
document.getElementById('resize').checked)">
</div> </div>
<hr/> <hr/>
......
...@@ -102,11 +102,20 @@ try: ...@@ -102,11 +102,20 @@ try:
shutil.copy(binariesPath + '/Web/FOnline.js.mem', gameOutputPath + '/FOnline.js.mem') shutil.copy(binariesPath + '/Web/FOnline.js.mem', gameOutputPath + '/FOnline.js.mem')
patchConfig(gameOutputPath + '/FOnline.js.mem') patchConfig(gameOutputPath + '/FOnline.js.mem')
# Generate resources
r = subprocess.call(['python', os.environ['EMSCRIPTEN'] + '/tools/file_packager.py', \ r = subprocess.call(['python', os.environ['EMSCRIPTEN'] + '/tools/file_packager.py', \
'Resources.data', '--preload', resourcesPath + '@/Data', '--js-output=Resources.js'], shell = True) 'Resources.data', '--preload', resourcesPath + '@/Data', '--js-output=Resources.js'], shell = True)
assert r == 0 assert r == 0
shutil.move('Resources.js', gameOutputPath + '/Resources.js') shutil.move('Resources.js', gameOutputPath + '/Resources.js')
shutil.move('Resources.data', gameOutputPath + '/Resources.data') shutil.move('Resources.data', gameOutputPath + '/Resources.data')
# Patch index.html
with open(gameOutputPath + '/index.html', 'rb') as f:
html = f.read()
html = html.replace('$TITLE$', gameName)
html = html.replace('$LOADING$', gameName)
with open(gameOutputPath + '/index.html', 'wb') as f:
f.write(html)
else: else:
assert False, 'Unknown build target' assert False, 'Unknown build target'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment