feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -17,6 +17,6 @@ this platform such as the html shell (web page).
|
|||
|
||||
## Artwork license
|
||||
|
||||
[`logo.png`](logo.png) and [`run_icon.png`](run_icon.png) are licensed under
|
||||
[`logo.svg`](export/logo.svg) and [`run_icon.svg`](export/run_icon.svg) are licensed under
|
||||
[Creative Commons Attribution 3.0 Unported](https://www.w3.org/html/logo/faq.html#how-licenced)
|
||||
per the HTML5 logo usage guidelines.
|
||||
|
|
|
|||
|
|
@ -61,8 +61,12 @@ for lib in sys_env["JS_LIBS"]:
|
|||
sys_env.Append(LINKFLAGS=["--js-library", lib.abspath])
|
||||
for js in sys_env["JS_PRE"]:
|
||||
sys_env.Append(LINKFLAGS=["--pre-js", js.abspath])
|
||||
|
||||
# Add JS externs to Closure.
|
||||
sys_env["ENV"]["EMCC_CLOSURE_ARGS"] = sys_env["ENV"].get("EMCC_CLOSURE_ARGS", "")
|
||||
for ext in sys_env["JS_EXTERNS"]:
|
||||
sys_env["ENV"]["EMCC_CLOSURE_ARGS"] += " --externs " + ext.abspath
|
||||
sys_env["ENV"]["EMCC_CLOSURE_ARGS"] = sys_env["ENV"]["EMCC_CLOSURE_ARGS"].strip()
|
||||
|
||||
build = []
|
||||
build_targets = ["#bin/godot${PROGSUFFIX}.js", "#bin/godot${PROGSUFFIX}.wasm"]
|
||||
|
|
@ -82,7 +86,7 @@ if env["dlink_enabled"]:
|
|||
sys_env["LINKFLAGS"].remove("-fvisibility=hidden")
|
||||
|
||||
# The main emscripten runtime, with exported standard libraries.
|
||||
sys = sys_env.Program(build_targets, ["web_runtime.cpp"])
|
||||
sys = sys_env.add_program(build_targets, ["web_runtime.cpp"])
|
||||
|
||||
# The side library, containing all Godot code.
|
||||
wasm = env.add_program("#bin/godot.side${PROGSUFFIX}.wasm", web_files)
|
||||
|
|
@ -90,7 +94,7 @@ if env["dlink_enabled"]:
|
|||
else:
|
||||
# We use IDBFS. Since Emscripten 1.39.1 it needs to be linked explicitly.
|
||||
sys_env.Append(LIBS=["idbfs.js"])
|
||||
build = sys_env.Program(build_targets, web_files + ["web_runtime.cpp"])
|
||||
build = sys_env.add_program(build_targets, web_files + ["web_runtime.cpp"])
|
||||
|
||||
sys_env.Depends(build[0], sys_env["JS_LIBS"])
|
||||
sys_env.Depends(build[0], sys_env["JS_PRE"])
|
||||
|
|
@ -110,7 +114,9 @@ wrap_list = [
|
|||
build[0],
|
||||
js_engine,
|
||||
]
|
||||
js_wrapped = env.Textfile("#bin/godot", [env.File(f) for f in wrap_list], TEXTFILESUFFIX="${PROGSUFFIX}.wrapped.js")
|
||||
js_wrapped = env.NoCache(
|
||||
env.Textfile("#bin/godot", [env.File(f) for f in wrap_list], TEXTFILESUFFIX="${PROGSUFFIX}.wrapped.js")
|
||||
)
|
||||
|
||||
# 0 - unwrapped js file (use wrapped one instead)
|
||||
# 1 - wasm file
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEB_API_H
|
||||
#define WEB_API_H
|
||||
#pragma once
|
||||
|
||||
void register_web_api();
|
||||
void unregister_web_api();
|
||||
|
||||
#endif // WEB_API_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef JAVASCRIPT_BRIDGE_SINGLETON_H
|
||||
#define JAVASCRIPT_BRIDGE_SINGLETON_H
|
||||
#pragma once
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
|
|
@ -69,5 +68,3 @@ public:
|
|||
JavaScriptBridge();
|
||||
~JavaScriptBridge();
|
||||
};
|
||||
|
||||
#endif // JAVASCRIPT_BRIDGE_SINGLETON_H
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ void AudioDriverWeb::_audio_driver_process(int p_from, int p_samples) {
|
|||
}
|
||||
|
||||
void AudioDriverWeb::_audio_driver_capture(int p_from, int p_samples) {
|
||||
if (get_input_buffer().size() == 0) {
|
||||
if (get_input_buffer().is_empty()) {
|
||||
return; // Input capture stopped.
|
||||
}
|
||||
const int max_samples = memarr_len(input_rb);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef AUDIO_DRIVER_WEB_H
|
||||
#define AUDIO_DRIVER_WEB_H
|
||||
#pragma once
|
||||
|
||||
#include "godot_audio.h"
|
||||
#include "godot_js.h"
|
||||
|
|
@ -191,5 +190,3 @@ public:
|
|||
|
||||
AudioDriverScriptProcessor() { singleton = this; }
|
||||
};
|
||||
|
||||
#endif // AUDIO_DRIVER_WEB_H
|
||||
|
|
|
|||
|
|
@ -89,7 +89,17 @@ def get_flags():
|
|||
}
|
||||
|
||||
|
||||
def library_emitter(target, source, env):
|
||||
# Make every source file dependent on the compiler version.
|
||||
# This makes sure that when emscripten is updated, that the cached files
|
||||
# aren't used and are recompiled instead.
|
||||
env.Depends(source, env.Value(get_compiler_version(env)))
|
||||
return target, source
|
||||
|
||||
|
||||
def configure(env: "SConsEnvironment"):
|
||||
env.Append(LIBEMITTER=[library_emitter])
|
||||
|
||||
# Validate arch.
|
||||
supported_arches = ["wasm32"]
|
||||
validate_arch(env["arch"], get_name(), supported_arches)
|
||||
|
|
@ -120,6 +130,10 @@ def configure(env: "SConsEnvironment"):
|
|||
## Copy env variables.
|
||||
env["ENV"] = os.environ
|
||||
|
||||
# This makes `wasm-ld` treat all warnings as errors.
|
||||
if env["werror"]:
|
||||
env.Append(LINKFLAGS=["-Wl,--fatal-warnings"])
|
||||
|
||||
# LTO
|
||||
|
||||
if env["lto"] == "auto": # Enable LTO for production.
|
||||
|
|
@ -171,9 +185,6 @@ def configure(env: "SConsEnvironment"):
|
|||
# Add method for creating the final zip file
|
||||
env.AddMethod(create_template_zip, "CreateTemplateZip")
|
||||
|
||||
# Closure compiler extern and support for ecmascript specs (const, let, etc).
|
||||
env["ENV"]["EMCC_CLOSURE_ARGS"] = "--language_in ECMASCRIPT_2021"
|
||||
|
||||
env["CC"] = "emcc"
|
||||
env["CXX"] = "em++"
|
||||
|
||||
|
|
|
|||
|
|
@ -384,12 +384,10 @@ const char *DisplayServerWeb::godot2dom_cursor(DisplayServer::CursorShape p_shap
|
|||
}
|
||||
|
||||
bool DisplayServerWeb::tts_is_speaking() const {
|
||||
ERR_FAIL_COND_V_MSG(!tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
|
||||
return godot_js_tts_is_speaking();
|
||||
}
|
||||
|
||||
bool DisplayServerWeb::tts_is_paused() const {
|
||||
ERR_FAIL_COND_V_MSG(!tts, false, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
|
||||
return godot_js_tts_is_paused();
|
||||
}
|
||||
|
||||
|
|
@ -424,13 +422,11 @@ void DisplayServerWeb::_update_voices_callback(const Vector<String> &p_voices) {
|
|||
}
|
||||
|
||||
TypedArray<Dictionary> DisplayServerWeb::tts_get_voices() const {
|
||||
ERR_FAIL_COND_V_MSG(!tts, TypedArray<Dictionary>(), "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
|
||||
godot_js_tts_get_voices(update_voices_callback);
|
||||
return voices;
|
||||
}
|
||||
|
||||
void DisplayServerWeb::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {
|
||||
ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
|
||||
if (p_interrupt) {
|
||||
tts_stop();
|
||||
}
|
||||
|
|
@ -447,17 +443,14 @@ void DisplayServerWeb::tts_speak(const String &p_text, const String &p_voice, in
|
|||
}
|
||||
|
||||
void DisplayServerWeb::tts_pause() {
|
||||
ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
|
||||
godot_js_tts_pause();
|
||||
}
|
||||
|
||||
void DisplayServerWeb::tts_resume() {
|
||||
ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
|
||||
godot_js_tts_resume();
|
||||
}
|
||||
|
||||
void DisplayServerWeb::tts_stop() {
|
||||
ERR_FAIL_COND_MSG(!tts, "Enable the \"audio/general/text_to_speech\" project setting to use text-to-speech.");
|
||||
for (const KeyValue<int, CharString> &E : utterance_ids) {
|
||||
tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, E.key);
|
||||
}
|
||||
|
|
@ -1086,7 +1079,6 @@ DisplayServer *DisplayServerWeb::create_func(const String &p_rendering_driver, W
|
|||
DisplayServerWeb::DisplayServerWeb(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Point2i *p_position, const Size2i &p_resolution, int p_screen, Context p_context, int64_t p_parent_window, Error &r_error) {
|
||||
r_error = OK; // Always succeeds for now.
|
||||
|
||||
tts = GLOBAL_GET("audio/general/text_to_speech");
|
||||
native_menu = memnew(NativeMenu); // Dummy native menu.
|
||||
|
||||
// Ensure the canvas ID.
|
||||
|
|
@ -1199,7 +1191,7 @@ bool DisplayServerWeb::has_feature(Feature p_feature) const {
|
|||
case FEATURE_VIRTUAL_KEYBOARD:
|
||||
return godot_js_display_vk_available() != 0;
|
||||
case FEATURE_TEXT_TO_SPEECH:
|
||||
return tts && (godot_js_display_tts_available() != 0);
|
||||
return godot_js_display_tts_available() != 0;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef DISPLAY_SERVER_WEB_H
|
||||
#define DISPLAY_SERVER_WEB_H
|
||||
#pragma once
|
||||
|
||||
#include "servers/display_server.h"
|
||||
|
||||
|
|
@ -39,7 +38,7 @@
|
|||
#include <emscripten/html5.h>
|
||||
|
||||
class DisplayServerWeb : public DisplayServer {
|
||||
// No need to register with GDCLASS, it's platform-specific and nothing is added.
|
||||
GDSOFTCLASS(DisplayServerWeb, DisplayServer);
|
||||
|
||||
private:
|
||||
struct JSTouchEvent {
|
||||
|
|
@ -103,7 +102,6 @@ private:
|
|||
int key_event_pos = 0;
|
||||
|
||||
bool swap_cancel_ok = false;
|
||||
bool tts = false;
|
||||
NativeMenu *native_menu = nullptr;
|
||||
|
||||
MouseMode mouse_mode_base = MOUSE_MODE_VISIBLE;
|
||||
|
|
@ -293,5 +291,3 @@ public:
|
|||
DisplayServerWeb(const String &p_rendering_driver, WindowMode p_window_mode, VSyncMode p_vsync_mode, uint32_t p_flags, const Point2i *p_position, const Size2i &p_resolution, int p_screen, Context p_context, int64_t p_parent_window, Error &r_error);
|
||||
~DisplayServerWeb();
|
||||
};
|
||||
|
||||
#endif // DISPLAY_SERVER_WEB_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEB_TOOLS_EDITOR_PLUGIN_H
|
||||
#define WEB_TOOLS_EDITOR_PLUGIN_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/zip_io.h"
|
||||
#include "editor/plugins/editor_plugin.h"
|
||||
|
|
@ -45,12 +44,3 @@ public:
|
|||
|
||||
WebToolsEditorPlugin();
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
class WebToolsEditorPlugin {
|
||||
public:
|
||||
static void initialize() {}
|
||||
};
|
||||
|
||||
#endif // WEB_TOOLS_EDITOR_PLUGIN_H
|
||||
|
|
|
|||
|
|
@ -102,12 +102,14 @@ def create_template_zip(env, js, wasm, side):
|
|||
in_files.append("#misc/dist/html/offline-export.html")
|
||||
out_files.append(zip_dir.File("godot.offline.html"))
|
||||
|
||||
zip_files = env.InstallAs(out_files, in_files)
|
||||
env.Zip(
|
||||
"#bin/godot",
|
||||
zip_files,
|
||||
ZIPROOT=zip_dir,
|
||||
ZIPSUFFIX="${PROGSUFFIX}${ZIPSUFFIX}",
|
||||
zip_files = env.NoCache(env.InstallAs(out_files, in_files))
|
||||
env.NoCache(
|
||||
env.Zip(
|
||||
"#bin/godot",
|
||||
zip_files,
|
||||
ZIPROOT=zip_dir,
|
||||
ZIPSUFFIX="${PROGSUFFIX}${ZIPSUFFIX}",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEB_EDITOR_HTTP_SERVER_H
|
||||
#define WEB_EDITOR_HTTP_SERVER_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/image_loader.h"
|
||||
#include "core/io/stream_peer_tls.h"
|
||||
|
|
@ -70,5 +69,3 @@ public:
|
|||
Error listen(int p_port, IPAddress p_address, bool p_use_tls, String p_tls_key, String p_tls_cert);
|
||||
bool is_listening() const;
|
||||
};
|
||||
|
||||
#endif // WEB_EDITOR_HTTP_SERVER_H
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEB_EXPORT_H
|
||||
#define WEB_EXPORT_H
|
||||
#pragma once
|
||||
|
||||
void register_web_exporter_types();
|
||||
void register_web_exporter();
|
||||
|
||||
#endif // WEB_EXPORT_H
|
||||
|
|
|
|||
|
|
@ -164,15 +164,15 @@ void EditorExportPlatformWeb::_fix_html(Vector<uint8_t> &p_html, const Ref<Edito
|
|||
const String custom_head_include = p_preset->get("html/head_include");
|
||||
HashMap<String, String> replaces;
|
||||
replaces["$GODOT_URL"] = p_name + ".js";
|
||||
replaces["$GODOT_PROJECT_NAME"] = GLOBAL_GET("application/config/name");
|
||||
replaces["$GODOT_PROJECT_NAME"] = get_project_setting(p_preset, "application/config/name");
|
||||
replaces["$GODOT_HEAD_INCLUDE"] = head_include + custom_head_include;
|
||||
replaces["$GODOT_CONFIG"] = str_config;
|
||||
replaces["$GODOT_SPLASH_COLOR"] = "#" + Color(GLOBAL_GET("application/boot_splash/bg_color")).to_html(false);
|
||||
replaces["$GODOT_SPLASH_COLOR"] = "#" + Color(get_project_setting(p_preset, "application/boot_splash/bg_color")).to_html(false);
|
||||
|
||||
LocalVector<String> godot_splash_classes;
|
||||
godot_splash_classes.push_back("show-image--" + String(GLOBAL_GET("application/boot_splash/show_image")));
|
||||
godot_splash_classes.push_back("fullsize--" + String(GLOBAL_GET("application/boot_splash/fullsize")));
|
||||
godot_splash_classes.push_back("use-filter--" + String(GLOBAL_GET("application/boot_splash/use_filter")));
|
||||
godot_splash_classes.push_back("show-image--" + String(get_project_setting(p_preset, "application/boot_splash/show_image")));
|
||||
godot_splash_classes.push_back("fullsize--" + String(get_project_setting(p_preset, "application/boot_splash/fullsize")));
|
||||
godot_splash_classes.push_back("use-filter--" + String(get_project_setting(p_preset, "application/boot_splash/use_filter")));
|
||||
replaces["$GODOT_SPLASH_CLASSES"] = String(" ").join(godot_splash_classes);
|
||||
replaces["$GODOT_SPLASH"] = p_name + ".png";
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ void EditorExportPlatformWeb::_fix_html(Vector<uint8_t> &p_html, const Ref<Edito
|
|||
_replace_strings(replaces, p_html);
|
||||
}
|
||||
|
||||
Error EditorExportPlatformWeb::_add_manifest_icon(const String &p_path, const String &p_icon, int p_size, Array &r_arr) {
|
||||
Error EditorExportPlatformWeb::_add_manifest_icon(const Ref<EditorExportPreset> &p_preset, const String &p_path, const String &p_icon, int p_size, Array &r_arr) {
|
||||
const String name = p_path.get_file().get_basename();
|
||||
const String icon_name = vformat("%s.%dx%d.png", name, p_size, p_size);
|
||||
const String icon_dest = p_path.get_base_dir().path_join(icon_name);
|
||||
|
|
@ -202,7 +202,7 @@ Error EditorExportPlatformWeb::_add_manifest_icon(const String &p_path, const St
|
|||
icon->resize(p_size, p_size);
|
||||
}
|
||||
} else {
|
||||
icon = _get_project_icon();
|
||||
icon = _get_project_icon(p_preset);
|
||||
icon->resize(p_size, p_size);
|
||||
}
|
||||
const Error err = icon->save_png(icon_dest);
|
||||
|
|
@ -219,7 +219,7 @@ Error EditorExportPlatformWeb::_add_manifest_icon(const String &p_path, const St
|
|||
}
|
||||
|
||||
Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_preset, const String p_path, const Vector<SharedObject> &p_shared_objects) {
|
||||
String proj_name = GLOBAL_GET("application/config/name");
|
||||
String proj_name = get_project_setting(p_preset, "application/config/name");
|
||||
if (proj_name.is_empty()) {
|
||||
proj_name = "Godot Game";
|
||||
}
|
||||
|
|
@ -236,10 +236,11 @@ Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_prese
|
|||
replaces["___GODOT_ENSURE_CROSSORIGIN_ISOLATION_HEADERS___"] = ensure_crossorigin_isolation_headers ? "true" : "false";
|
||||
|
||||
// Files cached during worker install.
|
||||
Array cache_files;
|
||||
cache_files.push_back(name + ".html");
|
||||
cache_files.push_back(name + ".js");
|
||||
cache_files.push_back(name + ".offline.html");
|
||||
Array cache_files = {
|
||||
name + ".html",
|
||||
name + ".js",
|
||||
name + ".offline.html"
|
||||
};
|
||||
if (p_preset->get("html/export_icon")) {
|
||||
cache_files.push_back(name + ".icon.png");
|
||||
cache_files.push_back(name + ".apple-touch-icon.png");
|
||||
|
|
@ -250,9 +251,10 @@ Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_prese
|
|||
replaces["___GODOT_CACHE___"] = Variant(cache_files).to_json_string();
|
||||
|
||||
// Heavy files that are cached on demand.
|
||||
Array opt_cache_files;
|
||||
opt_cache_files.push_back(name + ".wasm");
|
||||
opt_cache_files.push_back(name + ".pck");
|
||||
Array opt_cache_files = {
|
||||
name + ".wasm",
|
||||
name + ".pck"
|
||||
};
|
||||
if (extensions) {
|
||||
opt_cache_files.push_back(name + ".side.wasm");
|
||||
for (int i = 0; i < p_shared_objects.size(); i++) {
|
||||
|
|
@ -306,19 +308,19 @@ Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_prese
|
|||
|
||||
Array icons_arr;
|
||||
const String icon144_path = p_preset->get("progressive_web_app/icon_144x144");
|
||||
err = _add_manifest_icon(p_path, icon144_path, 144, icons_arr);
|
||||
err = _add_manifest_icon(p_preset, p_path, icon144_path, 144, icons_arr);
|
||||
if (err != OK) {
|
||||
// Message is supplied by the subroutine method.
|
||||
return err;
|
||||
}
|
||||
const String icon180_path = p_preset->get("progressive_web_app/icon_180x180");
|
||||
err = _add_manifest_icon(p_path, icon180_path, 180, icons_arr);
|
||||
err = _add_manifest_icon(p_preset, p_path, icon180_path, 180, icons_arr);
|
||||
if (err != OK) {
|
||||
// Message is supplied by the subroutine method.
|
||||
return err;
|
||||
}
|
||||
const String icon512_path = p_preset->get("progressive_web_app/icon_512x512");
|
||||
err = _add_manifest_icon(p_path, icon512_path, 512, icons_arr);
|
||||
err = _add_manifest_icon(p_preset, p_path, icon512_path, 512, icons_arr);
|
||||
if (err != OK) {
|
||||
// Message is supplied by the subroutine method.
|
||||
return err;
|
||||
|
|
@ -559,7 +561,7 @@ Error EditorExportPlatformWeb::export_project(const Ref<EditorExportPreset> &p_p
|
|||
html.resize(0);
|
||||
|
||||
// Export splash (why?)
|
||||
Ref<Image> splash = _get_project_splash();
|
||||
Ref<Image> splash = _get_project_splash(p_preset);
|
||||
const String splash_png_path = base_path + ".png";
|
||||
if (splash->save_png(splash_png_path) != OK) {
|
||||
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), vformat(TTR("Could not write file: \"%s\"."), splash_png_path));
|
||||
|
|
@ -569,7 +571,7 @@ Error EditorExportPlatformWeb::export_project(const Ref<EditorExportPreset> &p_p
|
|||
// Save a favicon that can be accessed without waiting for the project to finish loading.
|
||||
// This way, the favicon can be displayed immediately when loading the page.
|
||||
if (export_icon) {
|
||||
Ref<Image> favicon = _get_project_icon();
|
||||
Ref<Image> favicon = _get_project_icon(p_preset);
|
||||
const String favicon_png_path = base_path + ".icon.png";
|
||||
if (favicon->save_png(favicon_png_path) != OK) {
|
||||
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), vformat(TTR("Could not write file: \"%s\"."), favicon_png_path));
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEB_EXPORT_PLUGIN_H
|
||||
#define WEB_EXPORT_PLUGIN_H
|
||||
#pragma once
|
||||
|
||||
#include "editor_http_server.h"
|
||||
|
||||
|
|
@ -76,11 +75,11 @@ class EditorExportPlatformWeb : public EditorExportPlatform {
|
|||
return name;
|
||||
}
|
||||
|
||||
Ref<Image> _get_project_icon() const {
|
||||
Ref<Image> _get_project_icon(const Ref<EditorExportPreset> &p_preset) const {
|
||||
Error err = OK;
|
||||
Ref<Image> icon;
|
||||
icon.instantiate();
|
||||
const String icon_path = String(GLOBAL_GET("application/config/icon")).strip_edges();
|
||||
const String icon_path = String(get_project_setting(p_preset, "application/config/icon")).strip_edges();
|
||||
if (!icon_path.is_empty()) {
|
||||
icon = _load_icon_or_splash_image(icon_path, &err);
|
||||
}
|
||||
|
|
@ -90,11 +89,11 @@ class EditorExportPlatformWeb : public EditorExportPlatform {
|
|||
return icon;
|
||||
}
|
||||
|
||||
Ref<Image> _get_project_splash() const {
|
||||
Ref<Image> _get_project_splash(const Ref<EditorExportPreset> &p_preset) const {
|
||||
Error err = OK;
|
||||
Ref<Image> splash;
|
||||
splash.instantiate();
|
||||
const String splash_path = String(GLOBAL_GET("application/boot_splash/image")).strip_edges();
|
||||
const String splash_path = String(get_project_setting(p_preset, "application/boot_splash/image")).strip_edges();
|
||||
if (!splash_path.is_empty()) {
|
||||
splash = _load_icon_or_splash_image(splash_path, &err);
|
||||
}
|
||||
|
|
@ -107,7 +106,7 @@ class EditorExportPlatformWeb : public EditorExportPlatform {
|
|||
Error _extract_template(const String &p_template, const String &p_dir, const String &p_name, bool pwa);
|
||||
void _replace_strings(const HashMap<String, String> &p_replaces, Vector<uint8_t> &r_template);
|
||||
void _fix_html(Vector<uint8_t> &p_html, const Ref<EditorExportPreset> &p_preset, const String &p_name, bool p_debug, BitField<EditorExportPlatform::DebugFlags> p_flags, const Vector<SharedObject> p_shared_objects, const Dictionary &p_file_sizes);
|
||||
Error _add_manifest_icon(const String &p_path, const String &p_icon, int p_size, Array &r_arr);
|
||||
Error _add_manifest_icon(const Ref<EditorExportPreset> &p_preset, const String &p_path, const String &p_icon, int p_size, Array &r_arr);
|
||||
Error _build_pwa(const Ref<EditorExportPreset> &p_preset, const String p_path, const Vector<SharedObject> &p_shared_objects);
|
||||
Error _write_or_error(const uint8_t *p_content, int p_len, String p_path);
|
||||
|
||||
|
|
@ -152,5 +151,3 @@ public:
|
|||
EditorExportPlatformWeb();
|
||||
~EditorExportPlatformWeb();
|
||||
};
|
||||
|
||||
#endif // WEB_EXPORT_PLUGIN_H
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="#fff" d="M7 5h18v21H7z"/><path fill="#eb6428" d="M3.143 1 5.48 27.504 15.967 31l10.553-3.496L28.857 1zM23.78 9.565H11.473l.275 3.308h11.759l-.911 9.937-6.556 1.808v.02h-.073l-6.61-1.828-.402-5.076h3.195l.234 2.552 3.583.97 3.595-.97.402-4.165H8.788L7.93 6.37h16.145z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="#fff" d="M7 5h18v21H7z"/><path fill="#eb6428" d="M3.143 1 5.48 27.504 15.967 31l10.553-3.496L28.857 1zM23.78 9.565H11.473l.275 3.308h11.759l-.911 9.937-6.556 1.808v.02h-.073l-6.61-1.828-.402-5.076h3.195l.234 2.552 3.583.97 3.595-.97.402-4.165H8.788L7.93 6.37h16.145z"/></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 351 B |
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="m2 1 1.09 12.357 4.9 1.63 4.9-1.63L13.98 1zm9.622 3.994h-5.74l.129 1.541h5.482l-.424 4.634-3.057.843v.01h-.033l-3.082-.853-.187-2.367h1.489l.11 1.19 1.67.452 1.676-.453.187-1.942h-5.21l-.4-4.546h7.527z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="m2 1 1.09 12.357 4.9 1.63 4.9-1.63L13.98 1zm9.622 3.994h-5.74l.129 1.541h5.482l-.424 4.634-3.057.843v.01h-.033l-3.082-.853-.187-2.367h1.489l.11 1.19 1.67.452 1.676-.453.187-1.942h-5.21l-.4-4.546h7.527z"/></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 319 B |
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GODOT_AUDIO_H
|
||||
#define GODOT_AUDIO_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -85,5 +84,3 @@ extern void godot_audio_script_start(float *p_in_buf, int p_in_size, float *p_ou
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GODOT_AUDIO_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GODOT_JS_H
|
||||
#define GODOT_JS_H
|
||||
#pragma once
|
||||
|
||||
#define WASM_EXPORT __attribute__((visibility("default")))
|
||||
|
||||
|
|
@ -136,5 +135,3 @@ extern void godot_js_display_vk_hide();
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GODOT_JS_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GODOT_MIDI_H
|
||||
#define GODOT_MIDI_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -47,5 +46,3 @@ extern void godot_js_webmidi_close_midi_inputs();
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GODOT_MIDI_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GODOT_WEBGL2_H
|
||||
#define GODOT_WEBGL2_H
|
||||
#pragma once
|
||||
|
||||
#include <GLES3/gl3.h>
|
||||
#include <webgl/webgl2.h>
|
||||
|
|
@ -53,5 +52,3 @@ void godot_webgl2_glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GODOT_WEBGL2_H
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ Error HTTPClientWeb::connect_to_host(const String &p_host, int p_port, Ref<TLSOp
|
|||
|
||||
String host_lower = host.to_lower();
|
||||
if (host_lower.begins_with("http://")) {
|
||||
host = host.substr(7, host.length() - 7);
|
||||
host = host.substr(7);
|
||||
use_tls = false;
|
||||
} else if (host_lower.begins_with("https://")) {
|
||||
use_tls = true;
|
||||
host = host.substr(8, host.length() - 8);
|
||||
host = host.substr(8);
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(host.length() < HOST_MIN_LEN, ERR_INVALID_PARAMETER);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef HTTP_CLIENT_WEB_H
|
||||
#define HTTP_CLIENT_WEB_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/http_client.h"
|
||||
|
||||
|
|
@ -104,5 +103,3 @@ public:
|
|||
HTTPClientWeb();
|
||||
~HTTPClientWeb();
|
||||
};
|
||||
|
||||
#endif // HTTP_CLIENT_WEB_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef IP_WEB_H
|
||||
#define IP_WEB_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/ip.h"
|
||||
|
||||
|
|
@ -47,5 +46,3 @@ public:
|
|||
static void make_default();
|
||||
IPWeb();
|
||||
};
|
||||
|
||||
#endif // IP_WEB_H
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ extern int godot_js_wrapper_object_transfer_buffer(int p_id, void *p_byte_arr, v
|
|||
};
|
||||
|
||||
class JavaScriptObjectImpl : public JavaScriptObject {
|
||||
GDSOFTCLASS(JavaScriptObjectImpl, JavaScriptObject);
|
||||
|
||||
private:
|
||||
friend class JavaScriptBridge;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef NET_SOCKET_WEB_H
|
||||
#define NET_SOCKET_WEB_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/net_socket.h"
|
||||
|
||||
|
|
@ -68,5 +67,3 @@ public:
|
|||
|
||||
NetSocketWeb() {}
|
||||
};
|
||||
|
||||
#endif // NET_SOCKET_WEB_H
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ void OS_Web::vibrate_handheld(int p_duration_ms, float p_amplitude) {
|
|||
|
||||
String OS_Web::get_user_data_dir(const String &p_user_dir) const {
|
||||
String userfs = "/userfs";
|
||||
return userfs.path_join(p_user_dir).replace("\\", "/");
|
||||
return userfs.path_join(p_user_dir).replace_char('\\', '/');
|
||||
}
|
||||
|
||||
String OS_Web::get_cache_path() const {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OS_WEB_H
|
||||
#define OS_WEB_H
|
||||
#pragma once
|
||||
|
||||
#include "audio_driver_web.h"
|
||||
#include "webmidi_driver.h"
|
||||
|
|
@ -119,5 +118,3 @@ public:
|
|||
|
||||
OS_Web();
|
||||
};
|
||||
|
||||
#endif // OS_WEB_H
|
||||
|
|
|
|||
|
|
@ -28,4 +28,6 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <alloca.h>
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef PLATFORM_GL_H
|
||||
#define PLATFORM_GL_H
|
||||
#pragma once
|
||||
|
||||
#ifndef GLES_API_ENABLED
|
||||
#define GLES_API_ENABLED // Allow using GLES.
|
||||
|
|
@ -40,5 +39,3 @@
|
|||
#define eglGetProcAddress(n) static_assert(false, "Usage of eglGetProcessAddress() on the web is a bug.")
|
||||
|
||||
#include "platform/web/godot_webgl2.h"
|
||||
|
||||
#endif // PLATFORM_GL_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEBMIDI_DRIVER_H
|
||||
#define WEBMIDI_DRIVER_H
|
||||
#pragma once
|
||||
|
||||
#include "core/os/midi_driver.h"
|
||||
|
||||
|
|
@ -57,5 +56,3 @@ public:
|
|||
WASM_EXPORT static void on_midi_message(int p_device_index, int p_status, const uint8_t *p_data, int p_data_len);
|
||||
static void _on_midi_message(int p_device_index, int p_status, const PackedByteArray &p_data, int p_data_len);
|
||||
};
|
||||
|
||||
#endif // WEBMIDI_DRIVER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue