diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-11-23 10:50:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-23 10:50:15 +0100 |
commit | 94959cb16bbe09ff4004f1cb578d157671894dc8 (patch) | |
tree | 080716002769ea8691b9d0bbe4f4149abfaa482a /main/main.cpp | |
parent | 3c002510b65f66561633f5a685d88f2c1b1c06c0 (diff) | |
parent | 3f34832dbac5068689c260608e6eaa7012964a70 (diff) |
Merge pull request #47567 from Calinou/add-boot-splash-image-setting
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/main/main.cpp b/main/main.cpp index 9f51025cc3..ab44149988 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1700,9 +1700,10 @@ Error Main::setup2(Thread::ID p_main_tid_override) { RenderingServer::get_singleton()->set_default_clear_color(clear); if (show_logo) { //boot logo! - String boot_logo_path = GLOBAL_DEF("application/boot_splash/image", String()); - bool boot_logo_scale = GLOBAL_DEF("application/boot_splash/fullsize", true); - bool boot_logo_filter = GLOBAL_DEF("application/boot_splash/use_filter", true); + const bool boot_logo_image = GLOBAL_DEF("application/boot_splash/show_image", true); + const String boot_logo_path = GLOBAL_DEF("application/boot_splash/image", String()); + const bool boot_logo_scale = GLOBAL_DEF("application/boot_splash/fullsize", true); + const bool boot_logo_filter = GLOBAL_DEF("application/boot_splash/use_filter", true); ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/image", PropertyInfo(Variant::STRING, "application/boot_splash/image", @@ -1710,14 +1711,19 @@ Error Main::setup2(Thread::ID p_main_tid_override) { Ref<Image> boot_logo; - boot_logo_path = boot_logo_path.strip_edges(); - - if (boot_logo_path != String()) { - boot_logo.instantiate(); - Error load_err = ImageLoader::load_image(boot_logo_path, boot_logo); - if (load_err) { - ERR_PRINT("Non-existing or invalid boot splash at '" + boot_logo_path + "'. Loading default splash."); + if (boot_logo_image) { + if (boot_logo_path != String()) { + boot_logo.instantiate(); + Error load_err = ImageLoader::load_image(boot_logo_path, boot_logo); + if (load_err) { + ERR_PRINT("Non-existing or invalid boot splash at '" + boot_logo_path + "'. Loading default splash."); + } } + } else { + // Create a 1×1 transparent image. This will effectively hide the splash image. + boot_logo.instantiate(); + boot_logo->create(1, 1, false, Image::FORMAT_RGBA8); + boot_logo->set_pixel(0, 0, Color(0, 0, 0, 0)); } #if defined(TOOLS_ENABLED) && !defined(NO_EDITOR_SPLASH) |