FullscreenUI: Use constant width/height scale on Android
Fixes achievement notifications being differently sized depending on the screen rotation.
This commit is contained in:
parent
7c2488c942
commit
f219b47e98
|
@ -2288,7 +2288,8 @@ void Achievements::DrawGameOverlays()
|
||||||
|
|
||||||
const auto lock = GetLock();
|
const auto lock = GetLock();
|
||||||
|
|
||||||
const float margin = std::max(ImGuiManager::GetScreenMargin(), LayoutScale(10.0f));
|
const float margin =
|
||||||
|
std::max(ImCeil(ImGuiManager::GetScreenMargin() * ImGuiManager::GetGlobalScale()), LayoutScale(10.0f));
|
||||||
const float spacing = LayoutScale(10.0f);
|
const float spacing = LayoutScale(10.0f);
|
||||||
const float padding = LayoutScale(10.0f);
|
const float padding = LayoutScale(10.0f);
|
||||||
const ImVec2 image_size =
|
const ImVec2 image_size =
|
||||||
|
|
|
@ -449,6 +449,8 @@ void ImGuiFullscreen::UploadAsyncTextures()
|
||||||
|
|
||||||
bool ImGuiFullscreen::UpdateLayoutScale()
|
bool ImGuiFullscreen::UpdateLayoutScale()
|
||||||
{
|
{
|
||||||
|
#ifndef __ANDROID__
|
||||||
|
|
||||||
static constexpr float LAYOUT_RATIO = LAYOUT_SCREEN_WIDTH / LAYOUT_SCREEN_HEIGHT;
|
static constexpr float LAYOUT_RATIO = LAYOUT_SCREEN_WIDTH / LAYOUT_SCREEN_HEIGHT;
|
||||||
const ImGuiIO& io = ImGui::GetIO();
|
const ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
@ -474,7 +476,19 @@ bool ImGuiFullscreen::UpdateLayoutScale()
|
||||||
|
|
||||||
UIStyle.RcpLayoutScale = 1.0f / UIStyle.LayoutScale;
|
UIStyle.RcpLayoutScale = 1.0f / UIStyle.LayoutScale;
|
||||||
|
|
||||||
return UIStyle.LayoutScale != old_scale;
|
return (UIStyle.LayoutScale != old_scale);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// On Android, treat a rotated display as always being in landscape mode for FSUI scaling.
|
||||||
|
// Makes achievement popups readable regardless of the device's orientation, and avoids layout changes.
|
||||||
|
const ImGuiIO& io = ImGui::GetIO();
|
||||||
|
const float old_scale = UIStyle.LayoutScale;
|
||||||
|
UIStyle.LayoutScale = std::max(io.DisplaySize.x, io.DisplaySize.y) / LAYOUT_SCREEN_WIDTH;
|
||||||
|
UIStyle.RcpLayoutScale = 1.0f / UIStyle.LayoutScale;
|
||||||
|
return (UIStyle.LayoutScale != old_scale);
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ImRect ImGuiFullscreen::CenterImage(const ImVec2& fit_size, const ImVec2& image_size)
|
ImRect ImGuiFullscreen::CenterImage(const ImVec2& fit_size, const ImVec2& image_size)
|
||||||
|
|
Loading…
Reference in New Issue