1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Add new scaling modes for splash screen

Removes the `fullsize` option which is superseded by `stretch_mode`.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
This commit is contained in:
Samuel Pedrajas
2021-10-25 19:27:12 +02:00
committed by Rémi Verschelde
parent 4979d9fc7b
commit fcc9f5ce39
13 changed files with 167 additions and 60 deletions

View File

@@ -1728,11 +1728,15 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (show_logo) { //boot logo!
const bool boot_logo_image = GLOBAL_DEF("application/boot_splash/show_image", true);
const String boot_logo_path = String(GLOBAL_DEF("application/boot_splash/image", String())).strip_edges();
const bool boot_logo_scale = GLOBAL_DEF("application/boot_splash/fullsize", true);
const RenderingServer::SplashStretchMode boot_stretch_mode =
(RenderingServer::SplashStretchMode)(int)GLOBAL_DEF("application/boot_splash/stretch_mode", RenderingServer::SPLASH_STRETCH_MODE_KEEP);
const bool boot_logo_filter = GLOBAL_DEF("application/boot_splash/use_filter", true);
ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/stretch_mode",
PropertyInfo(Variant::INT, "application/boot_splash/stretch_mode",
PROPERTY_HINT_ENUM, "Disabled,Keep,Keep Width,Keep Height,Cover,Expand")); // Sync with RenderingServer::SplashStretchMode.
ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/image",
PropertyInfo(Variant::STRING,
"application/boot_splash/image",
PropertyInfo(Variant::STRING, "application/boot_splash/image",
PROPERTY_HINT_FILE, "*.png"));
Ref<Image> boot_logo;
@@ -1760,9 +1764,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
const Color boot_bg_color = GLOBAL_DEF("application/boot_splash/bg_color", boot_splash_bg_color);
#endif
if (boot_logo.is_valid()) {
RenderingServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color, boot_logo_scale,
boot_logo_filter);
RenderingServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color,
boot_stretch_mode, boot_logo_filter);
} else {
#ifndef NO_DEFAULT_BOOT_LOGO
MAIN_PRINT("Main: Create bootsplash");
@@ -1775,7 +1778,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
MAIN_PRINT("Main: ClearColor");
RenderingServer::get_singleton()->set_default_clear_color(boot_bg_color);
MAIN_PRINT("Main: Image");
RenderingServer::get_singleton()->set_boot_image(splash, boot_bg_color, false);
RenderingServer::get_singleton()->set_boot_image(splash, boot_bg_color, RenderingServer::SPLASH_STRETCH_MODE_DISABLED);
#endif
}