fix: Variable naming style in splash window

This commit is contained in:
WerWolv 2024-06-05 22:24:00 +02:00
parent 348fe27a3c
commit 4797512207
2 changed files with 18 additions and 18 deletions

View file

@ -71,11 +71,11 @@ namespace hex::init {
std::string m_gpuVendor; std::string m_gpuVendor;
ImGuiExt::Texture splashBackgroundTexture; ImGuiExt::Texture m_splashBackgroundTexture;
ImGuiExt::Texture splashTextTexture; ImGuiExt::Texture m_splashTextTexture;
std::future<bool> tasksSucceeded; std::future<bool> m_tasksSucceeded;
std::array<Highlight, 4> highlights; std::array<Highlight, 4> m_highlights;
float progressLerp = 0.0F; float m_progressLerp = 0.0F;
}; };
} }

View file

@ -265,7 +265,7 @@ namespace hex::init {
{ {
// Draw the splash screen background // Draw the splash screen background
drawList->AddImage(this->splashBackgroundTexture, ImVec2(0, 0), this->splashBackgroundTexture.getSize()); drawList->AddImage(this->m_splashBackgroundTexture, ImVec2(0, 0), this->m_splashBackgroundTexture.getSize());
{ {
@ -315,14 +315,14 @@ namespace hex::init {
}; };
// Draw all highlights, slowly fading them in as the init tasks progress // Draw all highlights, slowly fading them in as the init tasks progress
for (const auto &highlight : this->highlights) for (const auto &highlight : this->m_highlights)
highlightBytes(highlight.start, highlight.count, highlight.color, this->progressLerp); highlightBytes(highlight.start, highlight.count, highlight.color, this->m_progressLerp);
} }
this->progressLerp += (m_progress - this->progressLerp) * 0.1F; this->m_progressLerp += (m_progress - this->m_progressLerp) * 0.1F;
// Draw the splash screen foreground // Draw the splash screen foreground
drawList->AddImage(this->splashTextTexture, ImVec2(0, 0), this->splashTextTexture.getSize()); drawList->AddImage(this->m_splashTextTexture, ImVec2(0, 0), this->m_splashTextTexture.getSize());
// Draw the "copyright" notice // Draw the "copyright" notice
drawList->AddText(ImVec2(35, 85), ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("WerWolv\n2020 - {0}", &__DATE__[7]).c_str()); drawList->AddText(ImVec2(35, 85), ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("WerWolv\n2020 - {0}", &__DATE__[7]).c_str());
@ -335,7 +335,7 @@ namespace hex::init {
const static auto VersionInfo = hex::format("{0}", ImHexApi::System::getImHexVersion()); const static auto VersionInfo = hex::format("{0}", ImHexApi::System::getImHexVersion());
#endif #endif
drawList->AddText(ImVec2((this->splashBackgroundTexture.getSize().x - ImGui::CalcTextSize(VersionInfo.c_str()).x) / 2, 105), ImColor(0xFF, 0xFF, 0xFF, 0xFF), VersionInfo.c_str()); drawList->AddText(ImVec2((this->m_splashBackgroundTexture.getSize().x - ImGui::CalcTextSize(VersionInfo.c_str()).x) / 2, 105), ImColor(0xFF, 0xFF, 0xFF, 0xFF), VersionInfo.c_str());
} }
// Draw the task progress bar // Draw the task progress bar
@ -371,8 +371,8 @@ namespace hex::init {
glfwSwapBuffers(m_window); glfwSwapBuffers(m_window);
// Check if all background tasks have finished so the splash screen can be closed // Check if all background tasks have finished so the splash screen can be closed
if (this->tasksSucceeded.wait_for(0s) == std::future_status::ready) { if (this->m_tasksSucceeded.wait_for(0s) == std::future_status::ready) {
if (this->tasksSucceeded.get()) { if (this->m_tasksSucceeded.get()) {
log::debug("All tasks finished successfully!"); log::debug("All tasks finished successfully!");
return FrameResult::Success; return FrameResult::Success;
} else { } else {
@ -538,12 +538,12 @@ namespace hex::init {
void WindowSplash::loadAssets() { void WindowSplash::loadAssets() {
// Load splash screen image from romfs // Load splash screen image from romfs
this->splashBackgroundTexture = ImGuiExt::Texture::fromImage(romfs::get("splash_background.png").span(), ImGuiExt::Texture::Filter::Linear); this->m_splashBackgroundTexture = ImGuiExt::Texture::fromImage(romfs::get("splash_background.png").span(), ImGuiExt::Texture::Filter::Linear);
this->splashTextTexture = ImGuiExt::Texture::fromImage(romfs::get("splash_text.png").span(), ImGuiExt::Texture::Filter::Linear); this->m_splashTextTexture = ImGuiExt::Texture::fromImage(romfs::get("splash_text.png").span(), ImGuiExt::Texture::Filter::Linear);
// If the image couldn't be loaded correctly, something went wrong during the build process // If the image couldn't be loaded correctly, something went wrong during the build process
// Close the application since this would lead to errors later on anyway. // Close the application since this would lead to errors later on anyway.
if (!this->splashBackgroundTexture.isValid() || !this->splashTextTexture.isValid()) { if (!this->m_splashBackgroundTexture.isValid() || !this->m_splashTextTexture.isValid()) {
log::error("Could not load splash screen image!"); log::error("Could not load splash screen image!");
} }
@ -552,7 +552,7 @@ namespace hex::init {
u32 lastPos = 0; u32 lastPos = 0;
u32 lastCount = 0; u32 lastCount = 0;
u32 index = 0; u32 index = 0;
for (auto &highlight : this->highlights) { for (auto &highlight : this->m_highlights) {
u32 newPos = lastPos + lastCount + (rng() % 35); u32 newPos = lastPos + lastCount + (rng() % 35);
u32 newCount = (rng() % 7) + 3; u32 newCount = (rng() % 7) + 3;
highlight.start.x = float(newPos % 13); highlight.start.x = float(newPos % 13);
@ -569,7 +569,7 @@ namespace hex::init {
void WindowSplash::startStartupTasks() { void WindowSplash::startStartupTasks() {
// Launch init tasks in the background // Launch init tasks in the background
this->tasksSucceeded = processTasksAsync(); this->m_tasksSucceeded = processTasksAsync();
} }
void WindowSplash::exitGLFW() const { void WindowSplash::exitGLFW() const {