FullscreenUI: Allow vertical scaling

This commit is contained in:
Connor McLaughlin 2021-02-22 03:16:50 +10:00
parent a7e4d55d02
commit 6e80c882df
2 changed files with 9 additions and 9 deletions

View File

@ -678,7 +678,7 @@ void DrawLandingWindow()
if (BeginFullscreenColumnWindow(0.0f, 570.0f, "logo", ImVec4(0.11f, 0.15f, 0.17f, 1.00f))) 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))); ImGui::Image(s_app_icon_texture->GetHandle(), LayoutScale(ImVec2(380.0f, 380.0f)));
} }
EndFullscreenColumnWindow(); EndFullscreenColumnWindow();
@ -720,7 +720,7 @@ void DrawLandingWindow()
{ {
bool about_visible, about_hovered, about_pressed; bool about_visible, about_hovered, about_pressed;
ImRect about_rect; 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_pressed = MenuButtonFrame("About", true, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY,
&about_visible, &about_hovered, &about_rect.Min, &about_rect.Max); &about_visible, &about_hovered, &about_rect.Min, &about_rect.Max);
@ -1041,7 +1041,7 @@ void DrawSettingsWindow()
s_settings_page = static_cast<SettingsPage>(i); s_settings_page = static_cast<SettingsPage>(i);
} }
ImGui::SetCursorPosY(LayoutScale(670.0f)); ImGui::SetCursorPosY(ImGui::GetWindowHeight() - LayoutScale(50.0f));
if (ActiveButton(ICON_FA_BACKWARD " Back", false)) if (ActiveButton(ICON_FA_BACKWARD " Back", false))
ReturnToMainWindow(); ReturnToMainWindow();
@ -2550,7 +2550,7 @@ void DrawGameListWindow()
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::SetCursorPosY(LayoutScale(670.0f)); ImGui::SetCursorPosY(ImGui::GetWindowHeight() - LayoutScale(50.0f));
BeginMenuButtons(); BeginMenuButtons();
if (ActiveButton(ICON_FA_BACKWARD " Back", false)) if (ActiveButton(ICON_FA_BACKWARD " Back", false))
ReturnToMainWindow(); ReturnToMainWindow();
@ -2779,7 +2779,7 @@ void DrawOSDMessages()
const float margin = LayoutScale(10.0f); const float margin = LayoutScale(10.0f);
const float padding = LayoutScale(10.0f); const float padding = LayoutScale(10.0f);
float position_x = margin; float position_x = margin;
float position_y = (margin + ImGuiFullscreen::g_layout_padding_top); float position_y = margin;
s_host_interface->EnumerateOSDMessages( s_host_interface->EnumerateOSDMessages(
[max_width, spacing, padding, &position_x, &position_y](const std::string& message, float time_remaining) -> bool { [max_width, spacing, padding, &position_x, &position_y](const std::string& message, float time_remaining) -> bool {

View File

@ -225,7 +225,7 @@ void EndLayout()
const float notification_margin = LayoutScale(10.0f); const float notification_margin = LayoutScale(10.0f);
const float spacing = 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); DrawBackgroundProgressDialogs(position, spacing);
DrawNotifications(position, spacing); DrawNotifications(position, spacing);
@ -235,8 +235,8 @@ void EndLayout()
bool BeginFullscreenColumns(const char* title) bool BeginFullscreenColumns(const char* title)
{ {
ImGui::SetNextWindowPos(ImVec2(g_layout_padding_left, g_layout_padding_top)); ImGui::SetNextWindowPos(ImVec2(g_layout_padding_left, 0.0f));
ImGui::SetNextWindowSize(LayoutScale(ImVec2(LAYOUT_SCREEN_WIDTH, LAYOUT_SCREEN_HEIGHT))); ImGui::SetNextWindowSize(ImVec2(LayoutScale(LAYOUT_SCREEN_WIDTH), ImGui::GetIO().DisplaySize.y));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 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) bool BeginFullscreenColumnWindow(float start, float end, const char* name, const ImVec4& background)
{ {
const ImVec2 pos(LayoutScale(start), 0.0f); 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); ImGui::PushStyleColor(ImGuiCol_ChildBg, background);