mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 20:31:41 +00:00
add furigana support for marquee text for options
This commit is contained in:
parent
2ba725708d
commit
703684b9c7
1 changed files with 41 additions and 5 deletions
|
|
@ -201,15 +201,51 @@ void DrawTextWithMarquee(const ImFont* font, float fontSize, const ImVec2& pos,
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
auto rectWidth = max.x - min.x;
|
auto rectWidth = max.x - min.x;
|
||||||
auto textSize = font->CalcTextSizeA(fontSize, FLT_MAX, 0, text);
|
auto textSize = font->CalcTextSizeA(fontSize, FLT_MAX, 0, text);
|
||||||
auto textX = pos.x - fmodf(std::max(0.0, ImGui::GetTime() - (time + delay)) * speed, textSize.x + rectWidth);
|
auto textX = position.x - fmodf(std::max(0.0, ImGui::GetTime() - (time + delay)) * speed, textSize.x + rectWidth);
|
||||||
|
|
||||||
drawList->PushClipRect(min, max, true);
|
drawList->PushClipRect(min, max, true);
|
||||||
|
|
||||||
if (textX <= pos.x)
|
if (textX <= position.x)
|
||||||
drawList->AddText(font, fontSize, { textX, pos.y }, color, text);
|
{
|
||||||
|
DrawRubyAnnotatedText
|
||||||
|
(
|
||||||
|
font,
|
||||||
|
fontSize,
|
||||||
|
rectWidth,
|
||||||
|
{ textX, position.y },
|
||||||
|
0.0f,
|
||||||
|
text,
|
||||||
|
[=](const char* str, ImVec2 pos)
|
||||||
|
{
|
||||||
|
DrawTextBasic(font, fontSize, pos, color, str);
|
||||||
|
},
|
||||||
|
[=](const char* str, float size, ImVec2 pos)
|
||||||
|
{
|
||||||
|
DrawTextBasic(font, size, pos, color, str);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (textX + textSize.x < pos.x)
|
if (textX + textSize.x < position.x)
|
||||||
drawList->AddText(font, fontSize, { textX + textSize.x + rectWidth, pos.y }, color, text);
|
{
|
||||||
|
DrawRubyAnnotatedText
|
||||||
|
(
|
||||||
|
font,
|
||||||
|
fontSize,
|
||||||
|
rectWidth,
|
||||||
|
{ textX + textSize.x + rectWidth, position.y },
|
||||||
|
0.0f,
|
||||||
|
text,
|
||||||
|
[=](const char* str, ImVec2 pos)
|
||||||
|
{
|
||||||
|
DrawTextBasic(font, fontSize, pos, color, str);
|
||||||
|
},
|
||||||
|
[=](const char* str, float size, ImVec2 pos)
|
||||||
|
{
|
||||||
|
DrawTextBasic(font, size, pos, color, str);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
drawList->PopClipRect();
|
drawList->PopClipRect();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue