summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2022-07-12 15:58:15 +0300
committerGitHub <noreply@github.com>2022-07-12 15:58:15 +0300
commit42537daeb1819b72a700acfe7ab6486b1a5d45d8 (patch)
tree3aa35cee95f0c0d0e58d6662ae9b74e7d36f8fd3 /main
parent9b3972ad48393559f772151646304e28f938a6fa (diff)
parentdad9683d11ca174cf50d0039fb0f05fb7439984f (diff)
Merge pull request #41833 from dalexeev/splash_delay
Add boot splash minimum display time setting
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp
index eb401cd9ef..2bb67f17f1 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2198,6 +2198,13 @@ bool Main::start() {
#endif
}
+ uint64_t minimum_time_msec = GLOBAL_DEF("application/boot_splash/minimum_display_time", 0);
+ ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/minimum_display_time",
+ PropertyInfo(Variant::INT,
+ "application/boot_splash/minimum_display_time",
+ PROPERTY_HINT_RANGE,
+ "0,100,1,or_greater,suffix:ms")); // No negative numbers.
+
#ifdef TOOLS_ENABLED
if (!doc_tool_path.is_empty()) {
// Needed to instance editor-only classes for their default values
@@ -2718,6 +2725,15 @@ bool Main::start() {
if (movie_writer) {
movie_writer->begin(DisplayServer::get_singleton()->window_get_size(), fixed_fps, write_movie_path);
}
+
+ if (minimum_time_msec) {
+ uint64_t minimum_time = 1000 * minimum_time_msec;
+ uint64_t elapsed_time = OS::get_singleton()->get_ticks_usec();
+ if (elapsed_time < minimum_time) {
+ OS::get_singleton()->delay_usec(minimum_time - elapsed_time);
+ }
+ }
+
return true;
}