diff --git a/main/gui/source/init/splash_window.cpp b/main/gui/source/init/splash_window.cpp index 6d3350891..bc47e0e7d 100644 --- a/main/gui/source/init/splash_window.cpp +++ b/main/gui/source/init/splash_window.cpp @@ -31,6 +31,8 @@ using namespace std::literals::chrono_literals; namespace hex::init { + + constexpr static auto WindowSize = ImVec2(640, 400); struct GlfwError { int errorCode = 0; @@ -258,7 +260,7 @@ namespace hex::init { FrameResult WindowSplash::fullFrame() { - glfwSetWindowSize(m_window, 640, 400); + glfwSetWindowSize(m_window, WindowSize.x, WindowSize.y); centerWindow(m_window); glfwPollEvents(); @@ -273,7 +275,7 @@ namespace hex::init { { // Draw the splash screen background - drawList->AddImage(this->m_splashBackgroundTexture, ImVec2(0, 0), this->m_splashBackgroundTexture.getSize()); + drawList->AddImage(this->m_splashBackgroundTexture, ImVec2(0, 0), WindowSize); { @@ -330,7 +332,7 @@ namespace hex::init { this->m_progressLerp += (m_progress - this->m_progressLerp) * 0.1F; // Draw the splash screen foreground - drawList->AddImage(this->m_splashTextTexture, ImVec2(0, 0), this->m_splashTextTexture.getSize()); + drawList->AddImage(this->m_splashTextTexture, ImVec2(0, 0), WindowSize); // Draw the "copyright" notice drawList->AddText(ImVec2(35, 85), ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("WerWolv\n2020 - {0}", &__DATE__[7]).c_str()); @@ -343,7 +345,7 @@ namespace hex::init { const static auto VersionInfo = hex::format("{0}", ImHexApi::System::getImHexVersion().get()); #endif - drawList->AddText(ImVec2((this->m_splashBackgroundTexture.getSize().x - ImGui::CalcTextSize(VersionInfo.c_str()).x) / 2, 105), ImColor(0xFF, 0xFF, 0xFF, 0xFF), VersionInfo.c_str()); + drawList->AddText(ImVec2((WindowSize.x - ImGui::CalcTextSize(VersionInfo.c_str()).x) / 2, 105), ImColor(0xFF, 0xFF, 0xFF, 0xFF), VersionInfo.c_str()); } // Draw the task progress bar @@ -553,8 +555,8 @@ namespace hex::init { // Load splash screen image from romfs const auto backingScale = ImHexApi::System::getNativeScale() * ImHexApi::System::getBackingScaleFactor(); - this->m_splashBackgroundTexture = ImGuiExt::Texture::fromSVG(romfs::get("splash_background.svg").span(), 640 * backingScale, 400 * backingScale, ImGuiExt::Texture::Filter::Linear); - this->m_splashTextTexture = ImGuiExt::Texture::fromSVG(romfs::get("splash_text.svg").span(), 640 * backingScale, 400 * backingScale, ImGuiExt::Texture::Filter::Linear); + this->m_splashBackgroundTexture = ImGuiExt::Texture::fromSVG(romfs::get("splash_background.svg").span(), WindowSize.x * backingScale, WindowSize.y * backingScale, ImGuiExt::Texture::Filter::Linear); + this->m_splashTextTexture = ImGuiExt::Texture::fromSVG(romfs::get("splash_text.svg").span(), WindowSize.x * backingScale, WindowSize.y * backingScale, ImGuiExt::Texture::Filter::Linear); // 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. @@ -589,6 +591,7 @@ namespace hex::init { void WindowSplash::exitGLFW() const { glfwDestroyWindow(m_window); + glfwTerminate(); } void WindowSplash::exitImGui() const {