mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-26 14:56:52 -04:00
HUD scaling fixes (#2192)
* Immediately apply hudScale to the dpad and rupee panes * Translate the dpad to follow along with the minimap scale
This commit is contained in:
+31
-9
@@ -27,6 +27,15 @@
|
||||
#if TARGET_PC
|
||||
#include "dusk/memory.h"
|
||||
#include "dusk/settings.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Reads the user HUD scale setting, clamped to a safe range.
|
||||
f32 dGetUserHudScale() {
|
||||
return std::clamp(dusk::getSettings().game.hudScale.getValue(), 0.5f, 2.0f);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
int dMeter2_c::_create() {
|
||||
@@ -669,9 +678,7 @@ void dMeter2_c::moveLife() {
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
const f32 lifeGaugeScale =
|
||||
g_drawHIO.mLifeParentScale *
|
||||
std::clamp(dusk::getSettings().game.hudScale.getValue(), 0.5f, 2.0f);
|
||||
const f32 lifeGaugeScale = g_drawHIO.mLifeParentScale * dGetUserHudScale();
|
||||
#else
|
||||
const f32 lifeGaugeScale = g_drawHIO.mLifeParentScale;
|
||||
#endif
|
||||
@@ -1108,8 +1115,13 @@ void dMeter2_c::moveRupee() {
|
||||
}
|
||||
}
|
||||
|
||||
if (mRupeeKeyScale != g_drawHIO.mRupeeKeyScale) {
|
||||
mRupeeKeyScale = g_drawHIO.mRupeeKeyScale;
|
||||
#if TARGET_PC
|
||||
const f32 rupeeKeyScale = g_drawHIO.mRupeeKeyScale * dGetUserHudScale();
|
||||
#else
|
||||
const f32 rupeeKeyScale = g_drawHIO.mRupeeKeyScale;
|
||||
#endif
|
||||
if (mRupeeKeyScale != rupeeKeyScale) {
|
||||
mRupeeKeyScale = rupeeKeyScale;
|
||||
draw_rupee = true;
|
||||
}
|
||||
|
||||
@@ -1207,8 +1219,13 @@ void dMeter2_c::moveKey() {
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyScale != g_drawHIO.mKeyScale) {
|
||||
mKeyScale = g_drawHIO.mKeyScale;
|
||||
#if TARGET_PC
|
||||
const f32 keyScale = g_drawHIO.mKeyScale * dGetUserHudScale();
|
||||
#else
|
||||
const f32 keyScale = g_drawHIO.mKeyScale;
|
||||
#endif
|
||||
if (mKeyScale != keyScale) {
|
||||
mKeyScale = keyScale;
|
||||
draw_key = true;
|
||||
}
|
||||
|
||||
@@ -2139,8 +2156,13 @@ void dMeter2_c::moveButtonCross() {
|
||||
draw_cross = true;
|
||||
}
|
||||
|
||||
if (mButtonCrossScale != g_drawHIO.mButtonCrossScale) {
|
||||
mButtonCrossScale = g_drawHIO.mButtonCrossScale;
|
||||
#if TARGET_PC
|
||||
const f32 buttonCrossScale = g_drawHIO.mButtonCrossScale * dGetUserHudScale();
|
||||
#else
|
||||
const f32 buttonCrossScale = g_drawHIO.mButtonCrossScale;
|
||||
#endif
|
||||
if (mButtonCrossScale != buttonCrossScale) {
|
||||
mButtonCrossScale = buttonCrossScale;
|
||||
draw_cross = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user