mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-28 05:11:37 +00:00
Properly center the achievements menu.
This commit is contained in:
parent
0e61a5a08b
commit
5cd8774669
2 changed files with 6 additions and 23 deletions
|
|
@ -134,8 +134,8 @@ static void DrawHeaderContainer(const char* text)
|
||||||
? Lerp(1, 0, colourMotion)
|
? Lerp(1, 0, colourMotion)
|
||||||
: Lerp(0, 1, colourMotion);
|
: Lerp(0, 1, colourMotion);
|
||||||
|
|
||||||
ImVec2 min = { Scale(containerMarginX), Scale(136) };
|
ImVec2 min = { Scale(g_aspectRatioOffsetX + containerMarginX), Scale(g_aspectRatioOffsetY + 136) };
|
||||||
ImVec2 max = { min.x + textMarginX * 2 + textSize.x + Scale(5), Scale(196) };
|
ImVec2 max = { min.x + textMarginX * 2 + textSize.x + Scale(5), Scale(g_aspectRatioOffsetY + 196) };
|
||||||
|
|
||||||
DrawPauseHeaderContainer(g_upWindow.get(), min, max, alpha);
|
DrawPauseHeaderContainer(g_upWindow.get(), min, max, alpha);
|
||||||
|
|
||||||
|
|
@ -568,8 +568,8 @@ static void DrawContentContainer()
|
||||||
? Hermite(604, 573, motion)
|
? Hermite(604, 573, motion)
|
||||||
: Hermite(573, 604, motion);
|
: Hermite(573, 604, motion);
|
||||||
|
|
||||||
ImVec2 min = { Scale(minX), Scale(minY) };
|
ImVec2 min = { Scale(g_aspectRatioOffsetX + minX), Scale(g_aspectRatioOffsetY + minY) };
|
||||||
ImVec2 max = { Scale(maxX), Scale(maxY) };
|
ImVec2 max = { Scale(g_aspectRatioOffsetX + maxX), Scale(g_aspectRatioOffsetY + maxY) };
|
||||||
|
|
||||||
// Transparency fade animation.
|
// Transparency fade animation.
|
||||||
auto alpha = g_isClosing
|
auto alpha = g_isClosing
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <gpu/video.h>
|
#include <gpu/video.h>
|
||||||
#include <app.h>
|
#include <app.h>
|
||||||
#include <version.h>
|
#include <version.h>
|
||||||
|
#include <patches/aspect_ratio_patches.h>
|
||||||
|
|
||||||
#define PIXELS_TO_UV_COORDS(textureWidth, textureHeight, x, y, width, height) \
|
#define PIXELS_TO_UV_COORDS(textureWidth, textureHeight, x, y, width, height) \
|
||||||
std::make_tuple(ImVec2((float)x / (float)textureWidth, (float)y / (float)textureHeight), \
|
std::make_tuple(ImVec2((float)x / (float)textureWidth, (float)y / (float)textureHeight), \
|
||||||
|
|
@ -95,34 +96,16 @@ inline void ResetOutline()
|
||||||
SetOutline(0.0f);
|
SetOutline(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aspect ratio aware.
|
|
||||||
inline float Scale(float size)
|
inline float Scale(float size)
|
||||||
{
|
{
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
|
|
||||||
constexpr float ORIGINAL_ASPECT_RATIO = 4.0f / 3.0f;
|
if (g_aspectRatio >= NARROW_ASPECT_RATIO)
|
||||||
float aspectRatio = io.DisplaySize.x / io.DisplaySize.y;
|
|
||||||
|
|
||||||
if (aspectRatio >= ORIGINAL_ASPECT_RATIO)
|
|
||||||
return size * (io.DisplaySize.y / 720.0f);
|
return size * (io.DisplaySize.y / 720.0f);
|
||||||
else
|
else
|
||||||
return size * (io.DisplaySize.x / 960.0f);
|
return size * (io.DisplaySize.x / 960.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not aspect ratio aware. Will stretch.
|
|
||||||
inline float ScaleX(float x)
|
|
||||||
{
|
|
||||||
auto& io = ImGui::GetIO();
|
|
||||||
return x * io.DisplaySize.x / 1280.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not aspect ratio aware. Will stretch.
|
|
||||||
inline float ScaleY(float y)
|
|
||||||
{
|
|
||||||
auto& io = ImGui::GetIO();
|
|
||||||
return y * io.DisplaySize.y / 720.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline double ComputeMotion(double duration, double offset, double total)
|
inline double ComputeMotion(double duration, double offset, double total)
|
||||||
{
|
{
|
||||||
return sqrt(std::clamp((ImGui::GetTime() - duration - offset / 60.0) / total * 60.0, 0.0, 1.0));
|
return sqrt(std::clamp((ImGui::GetTime() - duration - offset / 60.0) / total * 60.0, 0.0, 1.0));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue