summaryrefslogtreecommitdiff
path: root/platform/javascript/export
diff options
context:
space:
mode:
authoreska <eska@eska.me>2016-10-30 23:10:17 +0100
committereska <eska@eska.me>2016-10-31 01:28:01 +0100
commitd6f2862429399844ebdd16b61da3a3c9d14fba36 (patch)
tree063bf4bebefabc373119f50e7a76471fc6b7140d /platform/javascript/export
parent7384a6519f377ff926906ae37844c6e8044ae083 (diff)
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.
Diffstat (limited to 'platform/javascript/export')
-rw-r--r--platform/javascript/export/export.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index f934916aa2..721aef3e50 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -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) {