From 6e80c882dfc27f650bdc8a04a3cbf7e10146ba4f Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 22 Feb 2021 03:16:50 +1000 Subject: [PATCH] FullscreenUI: Allow vertical scaling --- src/frontend-common/fullscreen_ui.cpp | 10 +++++----- src/frontend-common/imgui_fullscreen.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/frontend-common/fullscreen_ui.cpp b/src/frontend-common/fullscreen_ui.cpp index becf8bac7..8618c8967 100644 --- a/src/frontend-common/fullscreen_ui.cpp +++ b/src/frontend-common/fullscreen_ui.cpp @@ -678,7 +678,7 @@ void DrawLandingWindow() if (BeginFullscreenColumnWindow(0.0f, 570.0f, "logo", ImVec4(0.11f, 0.15f, 0.17f, 1.00f))) { - ImGui::SetCursorPos(LayoutScale(ImVec2(120.0f, 170.0f))); + ImGui::SetCursorPos(ImVec2(120.0f, (ImGui::GetWindowHeight() * 0.5f) - LayoutScale(170.0f))); ImGui::Image(s_app_icon_texture->GetHandle(), LayoutScale(ImVec2(380.0f, 380.0f))); } EndFullscreenColumnWindow(); @@ -720,7 +720,7 @@ void DrawLandingWindow() { bool about_visible, about_hovered, about_pressed; ImRect about_rect; - ImGui::SetCursorPosY(LayoutScale(670.0f)); + ImGui::SetCursorPosY(ImGui::GetWindowHeight() - LayoutScale(50.0f)); about_pressed = MenuButtonFrame("About", true, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, &about_visible, &about_hovered, &about_rect.Min, &about_rect.Max); @@ -1041,7 +1041,7 @@ void DrawSettingsWindow() s_settings_page = static_cast(i); } - ImGui::SetCursorPosY(LayoutScale(670.0f)); + ImGui::SetCursorPosY(ImGui::GetWindowHeight() - LayoutScale(50.0f)); if (ActiveButton(ICON_FA_BACKWARD " Back", false)) ReturnToMainWindow(); @@ -2550,7 +2550,7 @@ void DrawGameListWindow() ImGui::EndGroup(); ImGui::PopStyleVar(); - ImGui::SetCursorPosY(LayoutScale(670.0f)); + ImGui::SetCursorPosY(ImGui::GetWindowHeight() - LayoutScale(50.0f)); BeginMenuButtons(); if (ActiveButton(ICON_FA_BACKWARD " Back", false)) ReturnToMainWindow(); @@ -2779,7 +2779,7 @@ void DrawOSDMessages() const float margin = LayoutScale(10.0f); const float padding = LayoutScale(10.0f); float position_x = margin; - float position_y = (margin + ImGuiFullscreen::g_layout_padding_top); + float position_y = margin; s_host_interface->EnumerateOSDMessages( [max_width, spacing, padding, &position_x, &position_y](const std::string& message, float time_remaining) -> bool { diff --git a/src/frontend-common/imgui_fullscreen.cpp b/src/frontend-common/imgui_fullscreen.cpp index 67726ba44..17028e3c7 100644 --- a/src/frontend-common/imgui_fullscreen.cpp +++ b/src/frontend-common/imgui_fullscreen.cpp @@ -225,7 +225,7 @@ void EndLayout() const float notification_margin = LayoutScale(10.0f); const float spacing = LayoutScale(10.0f); - ImVec2 position(notification_margin, g_layout_padding_top + LayoutScale(LAYOUT_SCREEN_HEIGHT) - notification_margin); + ImVec2 position(notification_margin, ImGui::GetIO().DisplaySize.y - notification_margin); DrawBackgroundProgressDialogs(position, spacing); DrawNotifications(position, spacing); @@ -235,8 +235,8 @@ void EndLayout() bool BeginFullscreenColumns(const char* title) { - ImGui::SetNextWindowPos(ImVec2(g_layout_padding_left, g_layout_padding_top)); - ImGui::SetNextWindowSize(LayoutScale(ImVec2(LAYOUT_SCREEN_WIDTH, LAYOUT_SCREEN_HEIGHT))); + ImGui::SetNextWindowPos(ImVec2(g_layout_padding_left, 0.0f)); + ImGui::SetNextWindowSize(ImVec2(LayoutScale(LAYOUT_SCREEN_WIDTH), ImGui::GetIO().DisplaySize.y)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); @@ -267,7 +267,7 @@ void EndFullscreenColumns() bool BeginFullscreenColumnWindow(float start, float end, const char* name, const ImVec4& background) { const ImVec2 pos(LayoutScale(start), 0.0f); - const ImVec2 size(LayoutScale(ImVec2(end - start, LAYOUT_SCREEN_HEIGHT))); + const ImVec2 size(LayoutScale(end - start), ImGui::GetIO().DisplaySize.y); ImGui::PushStyleColor(ImGuiCol_ChildBg, background);