diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-02-07 13:45:04 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-02-19 05:12:32 +0100 |
commit | 2972ea32297adfd9cc08c81dd85339679365f52e (patch) | |
tree | 63e41e958a5610449595354ace4c30f719b2a555 /platform/javascript/export/export.cpp | |
parent | 5c2fe970b87f8e95306bad0f713567a150b1e442 (diff) |
[HTML5] Easier HTML templates, better deinit/cleanup.
Diffstat (limited to 'platform/javascript/export/export.cpp')
-rw-r--r-- | platform/javascript/export/export.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 199d778314..fa8b000259 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -285,24 +285,29 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re String str_template = String::utf8(reinterpret_cast<const char *>(p_html.ptr()), p_html.size()); String str_export; Vector<String> lines = str_template.split("\n"); - Vector<String> flags; - String flags_json; - gen_export_flags(flags, p_flags); - flags_json = JSON::print(flags); - String libs; + Array libs; for (int i = 0; i < p_shared_objects.size(); i++) { - libs += "\"" + p_shared_objects[i].path.get_file() + "\","; + libs.push_back(p_shared_objects[i].path.get_file()); } + Vector<String> flags; + gen_export_flags(flags, p_flags & (~DEBUG_FLAG_DUMB_CLIENT)); + Array args; + for (int i = 0; i < flags.size(); i++) { + args.push_back(flags[i]); + } + Dictionary config; + config["canvasResizePolicy"] = p_preset->get("html/full_window_size") ? 2 : 1; + config["gdnativeLibs"] = libs; + config["executable"] = p_name; + config["args"] = args; + const String str_config = JSON::print(config); for (int i = 0; i < lines.size(); i++) { String current_line = lines[i]; - current_line = current_line.replace("$GODOT_BASENAME", p_name); + current_line = current_line.replace("$GODOT_URL", p_name + ".js"); current_line = current_line.replace("$GODOT_PROJECT_NAME", ProjectSettings::get_singleton()->get_setting("application/config/name")); current_line = current_line.replace("$GODOT_HEAD_INCLUDE", p_preset->get("html/head_include")); - current_line = current_line.replace("$GODOT_FULL_WINDOW", p_preset->get("html/full_window_size") ? "true" : "false"); - current_line = current_line.replace("$GODOT_GDNATIVE_LIBS", libs); - current_line = current_line.replace("$GODOT_DEBUG_ENABLED", p_debug ? "true" : "false"); - current_line = current_line.replace("$GODOT_ARGS", flags_json); + current_line = current_line.replace("$GODOT_CONFIG", str_config); str_export += current_line + "\n"; } |