From 106c35344b02fb8b64936728585bf656fd841edd Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 11 Feb 2024 00:18:20 +0100 Subject: [PATCH] fix: Fade in and out of language text in oobe screen being broken --- .../builtin/source/content/out_of_box_experience.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/builtin/source/content/out_of_box_experience.cpp b/plugins/builtin/source/content/out_of_box_experience.cpp index 3f1c8609e..da3ec53f3 100644 --- a/plugins/builtin/source/content/out_of_box_experience.cpp +++ b/plugins/builtin/source/content/out_of_box_experience.cpp @@ -47,6 +47,10 @@ namespace hex::plugin::builtin { return square / (2.0F * (square - t) + 1.0F); } + void reset() { + m_time = 0; + } + private: float m_time; float m_start, m_end; @@ -201,10 +205,16 @@ namespace hex::plugin::builtin { ImGui::NewLine(); ImGui::NewLine(); + static Blend textFadeOut(2.5F, 2.9F); + static Blend textFadeIn(0.1F, 0.5F); + auto currTime = ImGui::GetTime(); if ((currTime - prevTime) > 3) { prevTime = currTime; ++currLanguage; + + textFadeIn.reset(); + textFadeOut.reset(); } if (currLanguage == languages.end()) @@ -224,7 +234,7 @@ namespace hex::plugin::builtin { const auto availableWidth = ImGui::GetContentRegionAvail().x; if (ImGui::BeginChild("##language_text", ImVec2(availableWidth, 30_scaled))) { - ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetColorU32(ImGuiCol_Text, std::cos((currTime / 3) * 2 * std::numbers::pi) * 3 + 2)); + ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetColorU32(ImGuiCol_Text, textFadeIn - textFadeOut)); ImGuiExt::TextFormattedCentered("{}", LocalizationManager::getLocalizedString("hex.builtin.setting.interface.language", currLanguage->first)); ImGui::PopStyleColor(); }