diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-09-10 00:10:54 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-09-10 00:10:54 -0300 |
commit | 0fb7b5aa0c023d60880d259e70f7641152460aa6 (patch) | |
tree | 86f6432457a0cbf14a9994b5e0d23dbdad12421b /platform/javascript/export/export.cpp | |
parent | b0aa49accbd7e45dae38f1bd43b0fbdd11714211 (diff) |
HTML5 exporter Improvements
-Better template handling
-Voice support
-Stream support
Diffstat (limited to 'platform/javascript/export/export.cpp')
-rw-r--r-- | platform/javascript/export/export.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index b262684a59..c38035e64a 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -144,12 +144,16 @@ static void _fix_html(Vector<uint8_t>& html,const String& name,int max_memory) { str.parse_utf8((const char*)html.ptr(),html.size()); Vector<String> lines=str.split("\n"); for(int i=0;i<lines.size();i++) { - if (lines[i].find("godot.js")!=-1) { - strnew+="<script type=\"text/javascript\" src=\""+name+"_filesystem.js\"></script>\n"; - strnew+="<script async type=\"text/javascript\" src=\""+name+".js\"></script>\n"; - } else if (lines[i].find("var Module")!=-1) { - strnew+=lines[i]; - strnew+="TOTAL_MEMORY:"+itos(max_memory*1024*1024)+","; + + if (lines[i].find("$GODOTTMEM")!=-1) { + + strnew+=lines[i].replace("$GODOTTMEM",itos(max_memory*1024*1024))+"\n"; + } else if (lines[i].find("$GODOTFS")!=-1) { + strnew+=lines[i].replace("$GODOTFS",name+"fs.js")+"\n"; + } else if (lines[i].find("$GODOTMEM")!=-1) { + strnew+=lines[i].replace("$GODOTMEM",name+".mem")+"\n"; + } else if (lines[i].find("$GODOTJS")!=-1) { + strnew+=lines[i].replace("$GODOTJS",name+".js")+"\n"; } else { strnew+=lines[i]+"\n"; } @@ -267,10 +271,10 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool _fix_html(data,p_path.get_file().basename(),1<<(max_memory+5)); file=p_path.get_file(); } - if (file=="filesystem.js") { + if (file=="godotfs.js") { _fix_files(data,len); - file=p_path.get_file().basename()+"_filesystem.js"; + file=p_path.get_file().basename()+"fs.js"; } if (file=="godot.js") { @@ -278,6 +282,12 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool file=p_path.get_file().basename()+".js"; } + if (file=="godot.mem") { + + //_fix_godot(data); + file=p_path.get_file().basename()+".mem"; + } + String dst = p_path.get_base_dir().plus_file(file); FileAccess *f=FileAccess::open(dst,FileAccess::WRITE); if (!f) { |