You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
[HTML5] Easier HTML templates, better deinit/cleanup.
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user