1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Add option 'wasm' to compile to WebAssembly in web export

WebAssembly is still experimental, so disabled by default.

The HTML shell file now uses $GODOT_BASE, a placeholder for the
base filename, instead of $GODOT_JS, $GODOT_MEM and $GODOT_FS.
This commit is contained in:
eska
2016-10-30 23:10:17 +01:00
parent 7384a6519f
commit d6f2862429
4 changed files with 30 additions and 32 deletions

View File

@@ -180,9 +180,7 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t>& p_html, const St
String current_line = lines[i];
current_line = current_line.replace("$GODOT_TMEM",itos((1<<(max_memory+5))*1024*1024));
current_line = current_line.replace("$GODOT_FS",p_name+"fs.js");
current_line = current_line.replace("$GODOT_MEM",p_name+".mem");
current_line = current_line.replace("$GODOT_JS",p_name+".js");
current_line = current_line.replace("$GODOT_BASE",p_name);
current_line = current_line.replace("$GODOT_CANVAS_WIDTH",Globals::get_singleton()->get("display/width"));
current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",Globals::get_singleton()->get("display/height"));
current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) Globals::get_singleton()->get("application/name"));
@@ -319,16 +317,19 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
}
if (file=="godot.js") {
//_fix_godot(data);
file=p_path.get_file().basename()+".js";
}
if (file=="godot.mem") {
//_fix_godot(data);
file=p_path.get_file().basename()+".mem";
}
if (file=="godot.wasm") {
file=p_path.get_file().basename()+".wasm";
}
String dst = p_path.get_base_dir().plus_file(file);
FileAccess *f=FileAccess::open(dst,FileAccess::WRITE);
if (!f) {