From 8e21247a97cb3cc5bb5525aec81d534cfd078a84 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 2 May 2026 11:32:59 -0600 Subject: [PATCH] UI: Prelaunch fade + BG persistence --- res/rml/prelaunch.rcss | 28 +++++-- src/dusk/imgui/ImGuiConsole.cpp | 2 +- src/dusk/ui/document.cpp | 11 ++- src/dusk/ui/prelaunch.cpp | 130 ++++++++++++++++++-------------- src/dusk/ui/prelaunch.hpp | 4 + 5 files changed, 113 insertions(+), 62 deletions(-) diff --git a/res/rml/prelaunch.rcss b/res/rml/prelaunch.rcss index f846591497..4c7c6ab029 100644 --- a/res/rml/prelaunch.rcss +++ b/res/rml/prelaunch.rcss @@ -11,9 +11,27 @@ body { color: #FFFFFF; background-color: #000000; decorator: image(../prelaunch-bg.png cover left center); + filter: opacity(0); + transition: filter 1s 0.1s linear-in-out; } -.menu { +body[open] { + filter: opacity(1); +} + +content { + display: block; + width: 100%; + height: 100%; + filter: opacity(0); + transition: filter 0.2s linear-in-out; +} + +content[open] { + filter: opacity(1); +} + +menu { position: absolute; left: 96dp; top: 50%; @@ -28,7 +46,7 @@ body { gap: 48dp; } -.hero { +hero { display: flex; flex-direction: column; justify-content: center; @@ -36,7 +54,7 @@ body { gap: 8dp; } -.hero img { +hero img { width: 100%; } @@ -86,7 +104,7 @@ body { decorator: horizontal-gradient(#FEE685FF #FEE68500); } -.disk-status { +disk-status { position: absolute; left: 96dp; bottom: 72dp; @@ -95,7 +113,7 @@ body { gap: 8dp; } -.version-info { +version-info { position: absolute; right: 96dp; bottom: 72dp; diff --git a/src/dusk/imgui/ImGuiConsole.cpp b/src/dusk/imgui/ImGuiConsole.cpp index 80e0e97b16..7db2b863c2 100644 --- a/src/dusk/imgui/ImGuiConsole.cpp +++ b/src/dusk/imgui/ImGuiConsole.cpp @@ -368,7 +368,7 @@ namespace dusk { m_toasts.emplace_back(ImGui::GetIO().MouseSource == ImGuiMouseSource_TouchScreen ? "Tap to toggle menu"s : "Press F1 to toggle menu"s, - 2.5f); + 4.f); m_isLaunchInitialized = true; if (getSettings().game.liveSplitEnabled) { dusk::speedrun::connectLiveSplit(); diff --git a/src/dusk/ui/document.cpp b/src/dusk/ui/document.cpp index ad589d47cf..c9eb66f50a 100644 --- a/src/dusk/ui/document.cpp +++ b/src/dusk/ui/document.cpp @@ -17,7 +17,7 @@ Rml::ElementDocument* load_document(const Rml::String& source) { } // namespace Document::Document(const Rml::String& source) : mDocument(load_document(source)) { - // Block keydown events while hidden (except for Menu) + // Block events while hidden (except for Menu command) listen( Rml::EventId::Keydown, [this](Rml::Event& event) { @@ -27,6 +27,15 @@ Document::Document(const Rml::String& source) : mDocument(load_document(source)) } }, true); + const auto blockUnlessVisible = [this](Rml::Event& event) { + if (!visible()) { + event.StopImmediatePropagation(); + } + }; + listen(Rml::EventId::Mouseover, blockUnlessVisible, true); + listen(Rml::EventId::Click, blockUnlessVisible, true); + listen(Rml::EventId::Scroll, blockUnlessVisible, true); + listen(Rml::EventId::Focus, blockUnlessVisible, true); listen(Rml::EventId::Keydown, [this](Rml::Event& event) { const auto cmd = map_nav_event(event); diff --git a/src/dusk/ui/prelaunch.cpp b/src/dusk/ui/prelaunch.cpp index bc632c896f..707fd79fec 100644 --- a/src/dusk/ui/prelaunch.cpp +++ b/src/dusk/ui/prelaunch.cpp @@ -7,9 +7,9 @@ #include "dusk/ui/prelaunch_options.hpp" #include "version.h" -#include #include #include +#include namespace dusk::ui { namespace { @@ -20,26 +20,28 @@ const Rml::String kDocumentSource = R"RML( -