mirror of https://github.com/PCSX2/pcsx2.git
ImGuiFullscreen: Add LayoutUnscale()
This commit is contained in:
parent
69ff64149a
commit
7dc93bee7e
|
@ -61,6 +61,7 @@ namespace ImGuiFullscreen
|
||||||
ImFont* g_icon_font = nullptr;
|
ImFont* g_icon_font = nullptr;
|
||||||
|
|
||||||
float g_layout_scale = 1.0f;
|
float g_layout_scale = 1.0f;
|
||||||
|
float g_rcp_layout_scale = 1.0f;
|
||||||
float g_layout_padding_left = 0.0f;
|
float g_layout_padding_left = 0.0f;
|
||||||
float g_layout_padding_top = 0.0f;
|
float g_layout_padding_top = 0.0f;
|
||||||
|
|
||||||
|
@ -429,6 +430,8 @@ bool ImGuiFullscreen::UpdateLayoutScale()
|
||||||
g_layout_padding_left = 0.0f;
|
g_layout_padding_left = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_rcp_layout_scale = 1.0f / g_layout_scale;
|
||||||
|
|
||||||
return g_layout_scale != old_scale;
|
return g_layout_scale != old_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace ImGuiFullscreen
|
||||||
extern ImFont* g_large_font;
|
extern ImFont* g_large_font;
|
||||||
|
|
||||||
extern float g_layout_scale;
|
extern float g_layout_scale;
|
||||||
|
extern float g_rcp_layout_scale;
|
||||||
extern float g_layout_padding_left;
|
extern float g_layout_padding_left;
|
||||||
extern float g_layout_padding_top;
|
extern float g_layout_padding_top;
|
||||||
|
|
||||||
|
@ -56,7 +57,6 @@ namespace ImGuiFullscreen
|
||||||
extern ImVec4 UISecondaryTextColor;
|
extern ImVec4 UISecondaryTextColor;
|
||||||
|
|
||||||
static __fi float DPIScale(float v) { return ImGui::GetIO().DisplayFramebufferScale.x * v; }
|
static __fi float DPIScale(float v) { return ImGui::GetIO().DisplayFramebufferScale.x * v; }
|
||||||
|
|
||||||
static __fi float DPIScale(int v) { return ImGui::GetIO().DisplayFramebufferScale.x * static_cast<float>(v); }
|
static __fi float DPIScale(int v) { return ImGui::GetIO().DisplayFramebufferScale.x * static_cast<float>(v); }
|
||||||
|
|
||||||
static __fi ImVec2 DPIScale(const ImVec2& v)
|
static __fi ImVec2 DPIScale(const ImVec2& v)
|
||||||
|
@ -66,13 +66,10 @@ namespace ImGuiFullscreen
|
||||||
}
|
}
|
||||||
|
|
||||||
static __fi float WindowWidthScale(float v) { return ImGui::GetWindowWidth() * v; }
|
static __fi float WindowWidthScale(float v) { return ImGui::GetWindowWidth() * v; }
|
||||||
|
|
||||||
static __fi float WindowHeightScale(float v) { return ImGui::GetWindowHeight() * v; }
|
static __fi float WindowHeightScale(float v) { return ImGui::GetWindowHeight() * v; }
|
||||||
|
|
||||||
static __fi float LayoutScale(float v) { return g_layout_scale * v; }
|
static __fi float LayoutScale(float v) { return g_layout_scale * v; }
|
||||||
|
|
||||||
static __fi ImVec2 LayoutScale(const ImVec2& v) { return ImVec2(v.x * g_layout_scale, v.y * g_layout_scale); }
|
static __fi ImVec2 LayoutScale(const ImVec2& v) { return ImVec2(v.x * g_layout_scale, v.y * g_layout_scale); }
|
||||||
|
|
||||||
static __fi ImVec2 LayoutScale(float x, float y) { return ImVec2(x * g_layout_scale, y * g_layout_scale); }
|
static __fi ImVec2 LayoutScale(float x, float y) { return ImVec2(x * g_layout_scale, y * g_layout_scale); }
|
||||||
|
|
||||||
static __fi ImVec2 LayoutScaleAndOffset(float x, float y)
|
static __fi ImVec2 LayoutScaleAndOffset(float x, float y)
|
||||||
|
@ -80,6 +77,10 @@ namespace ImGuiFullscreen
|
||||||
return ImVec2(g_layout_padding_left + x * g_layout_scale, g_layout_padding_top + y * g_layout_scale);
|
return ImVec2(g_layout_padding_left + x * g_layout_scale, g_layout_padding_top + y * g_layout_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __fi float LayoutUnscale(float v) { return g_rcp_layout_scale * v; }
|
||||||
|
static __fi ImVec2 LayoutUnscale(const ImVec2& v) { return ImVec2(v.x * g_rcp_layout_scale, v.y * g_rcp_layout_scale); }
|
||||||
|
static __fi ImVec2 LayoutUnscale(float x, float y) { return ImVec2(x * g_rcp_layout_scale, y * g_rcp_layout_scale); }
|
||||||
|
|
||||||
static __fi ImVec4 ModAlpha(const ImVec4& v, float a) { return ImVec4(v.x, v.y, v.z, a); }
|
static __fi ImVec4 ModAlpha(const ImVec4& v, float a) { return ImVec4(v.x, v.y, v.z, a); }
|
||||||
static __fi ImVec4 MulAlpha(const ImVec4& v, float a) { return ImVec4(v.x, v.y, v.z, v.w * a); }
|
static __fi ImVec4 MulAlpha(const ImVec4& v, float a) { return ImVec4(v.x, v.y, v.z, v.w * a); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue