Merge pull request #47567 from Calinou/add-boot-splash-image-setting
This commit is contained in:
commit
94959cb16b
2 changed files with 23 additions and 13 deletions
|
@ -196,13 +196,17 @@
|
|||
Background color for the boot splash.
|
||||
</member>
|
||||
<member name="application/boot_splash/fullsize" type="bool" setter="" getter="" default="true">
|
||||
If [code]true[/code], scale the boot splash image to the full window length when engine starts. If [code]false[/code], the engine will leave it at the default pixel size.
|
||||
If [code]true[/code], scale the boot splash image to the full window size (preserving the aspect ratio) when the engine starts. If [code]false[/code], the engine will leave it at the default pixel size.
|
||||
</member>
|
||||
<member name="application/boot_splash/image" type="String" setter="" getter="" default="""">
|
||||
Path to an image used as the boot splash.
|
||||
Path to an image used as the boot splash. If left empty, the default Godot Engine splash will be displayed instead.
|
||||
[b]Note:[/b] Only effective if [member application/boot_splash/show_image] is [code]true[/code].
|
||||
</member>
|
||||
<member name="application/boot_splash/show_image" type="bool" setter="" getter="" default="true">
|
||||
If [code]true[/code], displays the image specified in [member application/boot_splash/image] when the engine starts. If [code]false[/code], only displays the plain color specified in [member application/boot_splash/bg_color].
|
||||
</member>
|
||||
<member name="application/boot_splash/use_filter" type="bool" setter="" getter="" default="true">
|
||||
If [code]true[/code], applies linear filtering when scaling the image (recommended for high resolution artwork). If [code]false[/code], uses nearest-neighbor interpolation (recommended for pixel art).
|
||||
If [code]true[/code], applies linear filtering when scaling the image (recommended for high-resolution artwork). If [code]false[/code], uses nearest-neighbor interpolation (recommended for pixel art).
|
||||
</member>
|
||||
<member name="application/config/custom_user_dir_name" type="String" setter="" getter="" default="""">
|
||||
This user directory is used for storing persistent data ([code]user://[/code] filesystem). If left empty, [code]user://[/code] resolves to a project-specific folder in Godot's own configuration folder (see [method OS.get_user_data_dir]). If a custom directory name is defined, this name will be used instead and appended to the system-specific user data directory (same parent folder as the Godot configuration folder documented in [method OS.get_user_data_dir]).
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue