You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
HTML5 start-up overhaul
- Implement promise-based JS interface for custom HTML page integration - Add download progress callback - Add progress bar and indeterminate spinner to default HTML page - Try downloading files multiple times when failing - Get rid of godotfs.js - Separate steps for engine initialization, game initialization and game start - Allow multiple games on one HTML page - Substitution placeholders only used in .html file - Placeholders renamed: $GODOT_BASE => $GODOT_BASENAME, $GODOT_TMEM -> $GODOT_TOTAL_MEMORY - Emscripten Module is now Engine.RuntimeEnvironment (no longer a global)
This commit is contained in:
@@ -100,8 +100,8 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
|
||||
String current_line = lines[i];
|
||||
current_line = current_line.replace("$GODOT_TMEM", itos(memory_mb * 1024 * 1024));
|
||||
current_line = current_line.replace("$GODOT_BASE", p_name);
|
||||
current_line = current_line.replace("$GODOT_TOTAL_MEMORY", itos(memory_mb * 1024 * 1024));
|
||||
current_line = current_line.replace("$GODOT_BASENAME", p_name);
|
||||
current_line = current_line.replace("$GODOT_HEAD_INCLUDE", p_preset->get("html/head_include"));
|
||||
current_line = current_line.replace("$GODOT_DEBUG_ENABLED", p_debug ? "true" : "false");
|
||||
str_export += current_line + "\n";
|
||||
@@ -114,28 +114,6 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re
|
||||
}
|
||||
}
|
||||
|
||||
void EditorExportPlatformJavaScript::_fix_fsloader_js(Vector<uint8_t> &p_js, const String &p_pack_name, uint64_t p_pack_size) {
|
||||
|
||||
String str_template = String::utf8(reinterpret_cast<const char *>(p_js.ptr()), p_js.size());
|
||||
String str_export;
|
||||
Vector<String> lines = str_template.split("\n");
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
if (lines[i].find("$GODOT_PACK_NAME") != -1) {
|
||||
str_export += lines[i].replace("$GODOT_PACK_NAME", p_pack_name);
|
||||
} else if (lines[i].find("$GODOT_PACK_SIZE") != -1) {
|
||||
str_export += lines[i].replace("$GODOT_PACK_SIZE", itos(p_pack_size));
|
||||
} else {
|
||||
str_export += lines[i] + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
CharString cs = str_export.utf8();
|
||||
p_js.resize(cs.length());
|
||||
for (int i = 0; i < cs.length(); i++) {
|
||||
p_js[i] = cs[i];
|
||||
}
|
||||
}
|
||||
|
||||
void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
|
||||
|
||||
if (p_preset->get("texture_format/s3tc")) {
|
||||
@@ -286,10 +264,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
|
||||
|
||||
_fix_html(data, p_preset, p_path.get_file().get_basename(), p_debug);
|
||||
file = p_path.get_file();
|
||||
} else if (file == "godotfs.js") {
|
||||
|
||||
_fix_fsloader_js(data, pck_path.get_file(), pack_size);
|
||||
file = p_path.get_file().get_basename() + "fs.js";
|
||||
} else if (file == "godot.js") {
|
||||
|
||||
file = p_path.get_file().get_basename() + ".js";
|
||||
|
||||
Reference in New Issue
Block a user