From df9506fbf6e3fc585d5e0431bec83448561c57c2 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 20 Jul 2025 12:58:37 +1000 Subject: [PATCH] FullscreenUI: Center loading screen logo --- src/util/imgui_fullscreen.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/util/imgui_fullscreen.cpp b/src/util/imgui_fullscreen.cpp index 7aabf0a4b..0d79f6e07 100644 --- a/src/util/imgui_fullscreen.cpp +++ b/src/util/imgui_fullscreen.cpp @@ -3957,23 +3957,17 @@ void ImGuiFullscreen::DrawLoadingScreen(std::string_view image, std::string_view const float width = (400.0f * scale); const bool has_progress = (progress_min < progress_max); - const float logo_width = 260.0f * scale; - const float logo_height = 260.0f * scale; + const float logo_width = ImCeil(260.0f * scale); + const float logo_height = ImCeil(260.0f * scale); - ImGui::SetNextWindowSize(ImVec2(logo_width, logo_height), ImGuiCond_Always); - ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x * 0.5f, (io.DisplaySize.y * 0.5f) - (50.0f * scale)), - ImGuiCond_Always, ImVec2(0.5f, 0.5f)); - if (ImGui::Begin("LoadingScreenLogo", nullptr, - ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove | - ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoNav | - ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | - ImGuiWindowFlags_NoBackground)) + GPUTexture* tex = GetCachedTexture(image); + if (tex) { - GPUTexture* tex = GetCachedTexture(image); - if (tex) - ImGui::Image(tex, ImVec2(logo_width, logo_height)); + const ImVec2 image_pos = ImVec2(ImCeil((io.DisplaySize.x - logo_width) * 0.5f), + ImCeil(((io.DisplaySize.y - logo_height) * 0.5f) - (50.0f * scale))); + const ImRect image_rect = CenterImage(ImRect(image_pos, image_pos + ImVec2(logo_width, logo_height)), tex); + ImGui::GetBackgroundDrawList()->AddImage(tex, image_rect.Min, image_rect.Max); } - ImGui::End(); const float padding_and_rounding = 18.0f * scale; const float frame_rounding = 6.0f * scale;