mirror of https://github.com/WerWolv/ImHex.git
fix: Fade in and out of language text in oobe screen being broken
This commit is contained in:
parent
12f64e5fde
commit
106c35344b
|
@ -47,6 +47,10 @@ namespace hex::plugin::builtin {
|
||||||
return square / (2.0F * (square - t) + 1.0F);
|
return square / (2.0F * (square - t) + 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset() {
|
||||||
|
m_time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float m_time;
|
float m_time;
|
||||||
float m_start, m_end;
|
float m_start, m_end;
|
||||||
|
@ -201,10 +205,16 @@ namespace hex::plugin::builtin {
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
|
|
||||||
|
static Blend textFadeOut(2.5F, 2.9F);
|
||||||
|
static Blend textFadeIn(0.1F, 0.5F);
|
||||||
|
|
||||||
auto currTime = ImGui::GetTime();
|
auto currTime = ImGui::GetTime();
|
||||||
if ((currTime - prevTime) > 3) {
|
if ((currTime - prevTime) > 3) {
|
||||||
prevTime = currTime;
|
prevTime = currTime;
|
||||||
++currLanguage;
|
++currLanguage;
|
||||||
|
|
||||||
|
textFadeIn.reset();
|
||||||
|
textFadeOut.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currLanguage == languages.end())
|
if (currLanguage == languages.end())
|
||||||
|
@ -224,7 +234,7 @@ namespace hex::plugin::builtin {
|
||||||
|
|
||||||
const auto availableWidth = ImGui::GetContentRegionAvail().x;
|
const auto availableWidth = ImGui::GetContentRegionAvail().x;
|
||||||
if (ImGui::BeginChild("##language_text", ImVec2(availableWidth, 30_scaled))) {
|
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));
|
ImGuiExt::TextFormattedCentered("{}", LocalizationManager::getLocalizedString("hex.builtin.setting.interface.language", currLanguage->first));
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue