mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-12-19 14:32:19 +00:00
imgui_utils: improve precise outline drawing
This commit is contained in:
parent
f5c6582065
commit
3c6e348499
2 changed files with 6 additions and 4 deletions
|
|
@ -141,14 +141,14 @@ static void DrawHeaderContainer(const char* text)
|
||||||
SetTextSkew((min.y + max.y) / 2.0f, Scale(3.0f));
|
SetTextSkew((min.y + max.y) / 2.0f, Scale(3.0f));
|
||||||
|
|
||||||
// TODO: Apply bevel.
|
// TODO: Apply bevel.
|
||||||
DrawTextWithOutline<int>
|
DrawTextWithOutline<float>
|
||||||
(
|
(
|
||||||
g_fntNewRodinUB,
|
g_fntNewRodinUB,
|
||||||
fontSize,
|
fontSize,
|
||||||
{ /* X */ min.x + textMarginX, /* Y */ CENTRE_TEXT_VERT(min, max, textSize) - Scale(5) },
|
{ /* X */ min.x + textMarginX, /* Y */ CENTRE_TEXT_VERT(min, max, textSize) - Scale(5) },
|
||||||
IM_COL32(255, 255, 255, 255 * alpha),
|
IM_COL32(255, 255, 255, 255 * alpha),
|
||||||
text,
|
text,
|
||||||
3,
|
1.65f,
|
||||||
IM_COL32(0, 0, 0, 255 * alpha)
|
IM_COL32(0, 0, 0, 255 * alpha)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,10 +188,12 @@ static void DrawTextWithOutline(const ImFont* font, float fontSize, const ImVec2
|
||||||
|
|
||||||
if constexpr (std::is_same_v<float, T> || std::is_same_v<double, T>)
|
if constexpr (std::is_same_v<float, T> || std::is_same_v<double, T>)
|
||||||
{
|
{
|
||||||
|
auto step = outlineSize / 2.0f;
|
||||||
|
|
||||||
// TODO: This is still very inefficient!
|
// TODO: This is still very inefficient!
|
||||||
for (float i = -outlineSize; i <= outlineSize; i += 0.5f)
|
for (float i = -outlineSize; i <= outlineSize; i += step)
|
||||||
{
|
{
|
||||||
for (float j = -outlineSize; j <= outlineSize; j += 0.5f)
|
for (float j = -outlineSize; j <= outlineSize; j += step)
|
||||||
{
|
{
|
||||||
if (i == 0.0f && j == 0.0f)
|
if (i == 0.0f && j == 0.0f)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue