mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Apply horizontal scaling to options menu value text (#685)
This commit is contained in:
parent
34a23d48db
commit
9fbd847d50
1 changed files with 16 additions and 5 deletions
|
|
@ -1165,28 +1165,39 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||||
size = Scale(20.0f);
|
size = Scale(20.0f);
|
||||||
textSize = g_newRodinFont->CalcTextSizeA(size, FLT_MAX, 0.0f, valueText.data());
|
textSize = g_newRodinFont->CalcTextSizeA(size, FLT_MAX, 0.0f, valueText.data());
|
||||||
|
|
||||||
min.x += ((max.x - min.x) - textSize.x) / 2.0f;
|
auto textSquashRatio = 1.0f;
|
||||||
min.y += ((max.y - min.y) - textSize.y) / 2.0f;
|
|
||||||
|
if (textSize.x > max.x - min.x)
|
||||||
|
textSquashRatio = (max.x - min.x) / textSize.x - 0.1f;
|
||||||
|
|
||||||
|
auto textX = min.x + ((max.x - min.x) - (textSize.x * textSquashRatio)) / 2.0f;
|
||||||
|
auto textY = min.y + ((max.y - min.y) - textSize.y) / 2.0f;
|
||||||
|
|
||||||
SetGradient
|
SetGradient
|
||||||
(
|
(
|
||||||
min,
|
{ textX, textY },
|
||||||
{ min.x + textSize.x, min.y + textSize.y },
|
{ textX + textSize.x, textY + textSize.y },
|
||||||
IM_COL32(192, 255, 0, 255),
|
IM_COL32(192, 255, 0, 255),
|
||||||
IM_COL32(128, 170, 0, 255)
|
IM_COL32(128, 170, 0, 255)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
SetScale({ textSquashRatio, 1.0f });
|
||||||
|
SetOrigin({ textX, textY });
|
||||||
|
|
||||||
DrawTextWithOutline
|
DrawTextWithOutline
|
||||||
(
|
(
|
||||||
g_newRodinFont,
|
g_newRodinFont,
|
||||||
size,
|
size,
|
||||||
min,
|
{ textX, textY },
|
||||||
IM_COL32(255, 255, 255, 255 * alpha),
|
IM_COL32(255, 255, 255, 255 * alpha),
|
||||||
valueText.data(),
|
valueText.data(),
|
||||||
4,
|
4,
|
||||||
IM_COL32(0, 0, 0, 255 * alpha)
|
IM_COL32(0, 0, 0, 255 * alpha)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
SetScale({ 1.0f, 1.0f });
|
||||||
|
SetOrigin({ 0.0f, 0.0f });
|
||||||
|
|
||||||
ResetGradient();
|
ResetGradient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue