mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-05-02 16:29:36 -05:00
Add ruby annotation support for text displayed in various spaces. (#232)
* allow preliminary annotation on DrawCenteredParagraph * improve annotated text line spacing * fix functionality of non-annotated paragraphs * a lot of very bad code that but line wrapping works * support ruby annotations for options menu descriptions * make installer wizard more accurate * remove wrapper function * add furigana support to config names * add furigana support for marquee text for options * fully support annotated text in options menu * fix option names being split to multiple lines * fix and cleanup installer wizard text placements * implement furigana support for message window * remove regex usage * remove excessive const ref usage
This commit is contained in:
@@ -65,19 +65,19 @@ static constexpr double PULSE_ANIMATION_LOOP_SPEED = 1.5;
|
||||
static constexpr double PULSE_ANIMATION_LOOP_DELAY = 0.5;
|
||||
static constexpr double PULSE_ANIMATION_LOOP_FADE_HIGH_POINT = 0.5;
|
||||
|
||||
constexpr float IMAGE_X = 165.0f;
|
||||
constexpr float IMAGE_Y = 106.0f;
|
||||
constexpr float IMAGE_X = 161.5f;
|
||||
constexpr float IMAGE_Y = 103.5f;
|
||||
constexpr float IMAGE_WIDTH = 512.0f;
|
||||
constexpr float IMAGE_HEIGHT = 512.0f;
|
||||
|
||||
constexpr float CONTAINER_X = 510.0f;
|
||||
constexpr float CONTAINER_Y = 225.0f;
|
||||
constexpr float CONTAINER_WIDTH = 528.0f;
|
||||
constexpr float CONTAINER_HEIGHT = 245.0f;
|
||||
constexpr float CONTAINER_X = 513.0f;
|
||||
constexpr float CONTAINER_Y = 226.0f;
|
||||
constexpr float CONTAINER_WIDTH = 526.5f;
|
||||
constexpr float CONTAINER_HEIGHT = 246.0f;
|
||||
constexpr float SIDE_CONTAINER_WIDTH = CONTAINER_WIDTH / 2.0f;
|
||||
|
||||
constexpr float BOTTOM_X_GAP = 4.0f;
|
||||
constexpr float BOTTOM_Y_GAP = 4.0f;
|
||||
constexpr float BOTTOM_Y_GAP = 6.0f;
|
||||
constexpr float CONTAINER_BUTTON_WIDTH = 250.0f;
|
||||
constexpr float CONTAINER_BUTTON_GAP = 9.0f;
|
||||
constexpr float BUTTON_HEIGHT = 22.0f;
|
||||
@@ -512,9 +512,9 @@ static void DrawHeaderIcons()
|
||||
{
|
||||
auto drawList = ImGui::GetForegroundDrawList();
|
||||
|
||||
float iconsPosX = 253.0f;
|
||||
float iconsPosY = 79.0f;
|
||||
float iconsScale = 58;
|
||||
float iconsPosX = 256.0f;
|
||||
float iconsPosY = 80.0f;
|
||||
float iconsScale = 62.0f;
|
||||
|
||||
// Miles Electric Icon
|
||||
float milesIconMotion = ComputeMotionInstaller(g_appearTime, g_disappearTime, MILES_ICON_ANIMATION_TIME, MILES_ICON_ANIMATION_DURATION);
|
||||
@@ -594,8 +594,8 @@ static void DrawScanlineBars()
|
||||
DrawTextWithOutline
|
||||
(
|
||||
g_dfsogeistdFont,
|
||||
Scale(42),
|
||||
{ g_aspectRatioOffsetX + Scale(285), Scale(57) },
|
||||
Scale(48.0f),
|
||||
{ g_aspectRatioOffsetX + Scale(288.0f), Scale(54.5f) },
|
||||
IM_COL32(255, 195, 0, 255 * alphaMotion * breatheMotion),
|
||||
headerText.c_str(), 4,
|
||||
IM_COL32(0, 0, 0, 255 * alphaMotion * breatheMotion),
|
||||
@@ -669,17 +669,18 @@ static void DrawContainer(ImVec2 min, ImVec2 max, bool isTextArea)
|
||||
}
|
||||
|
||||
// The draw area
|
||||
drawList->PushClipRect({ min.x + gridSize * 2.0f, min.y + gridSize * 2.0f }, { max.x - gridSize * 2.0f + 1.0f, max.y - gridSize * 2.0f + 1.0f });
|
||||
drawList->PushClipRect({ min.x - gridSize * 2.0f, min.y + gridSize * 2.0f }, { max.x - gridSize * 2.0f + 1.0f, max.y - gridSize * 2.0f + 1.0f });
|
||||
}
|
||||
|
||||
static void DrawDescriptionContainer()
|
||||
{
|
||||
auto &res = ImGui::GetIO().DisplaySize;
|
||||
auto drawList = ImGui::GetForegroundDrawList();
|
||||
auto fontSize = Scale(26.0f);
|
||||
auto fontSize = Scale(28.0f);
|
||||
auto annotationFontSize = fontSize * ANNOTATION_FONT_SIZE_MODIFIER;
|
||||
|
||||
ImVec2 descriptionMin = { round(g_aspectRatioOffsetX + Scale(CONTAINER_X)), round(g_aspectRatioOffsetY + Scale(CONTAINER_Y)) };
|
||||
ImVec2 descriptionMax = { round(g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH)), round(g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT)) };
|
||||
ImVec2 descriptionMin = { round(g_aspectRatioOffsetX + Scale(CONTAINER_X + 0.5f)), round(g_aspectRatioOffsetY + Scale(CONTAINER_Y + 0.5f)) };
|
||||
ImVec2 descriptionMax = { round(g_aspectRatioOffsetX + Scale(CONTAINER_X + 0.5f + CONTAINER_WIDTH)), round(g_aspectRatioOffsetY + Scale(CONTAINER_Y + 0.5f + CONTAINER_HEIGHT)) };
|
||||
SetProceduralOrigin(descriptionMin);
|
||||
DrawContainer(descriptionMin, descriptionMax, true);
|
||||
|
||||
@@ -706,19 +707,53 @@ static void DrawDescriptionContainer()
|
||||
auto clipRectMin = drawList->GetClipRectMin();
|
||||
auto clipRectMax = drawList->GetClipRectMax();
|
||||
|
||||
drawList->AddText
|
||||
float textX = clipRectMin.x + fontSize;
|
||||
float textY = clipRectMin.y - Scale(1.0f);
|
||||
|
||||
float lineMargin = 5.0f;
|
||||
|
||||
if (Config::Language == ELanguage::Japanese)
|
||||
{
|
||||
lineMargin = 5.5f;
|
||||
|
||||
// Removing some padding of the applied due to the inclusion of annotation for Japanese
|
||||
textX -= (fontSize + Scale(1.5f));
|
||||
textY -= Scale(7.0f);
|
||||
|
||||
// The annotation (and thus the Japanese) can be drawn above the edges of the info panel thus the clip needs to be extended a bit
|
||||
clipRectMin.x -= annotationFontSize;
|
||||
clipRectMin.y -= annotationFontSize;
|
||||
clipRectMax.x += annotationFontSize;
|
||||
clipRectMax.y += annotationFontSize;
|
||||
|
||||
textX += annotationFontSize;
|
||||
textY += annotationFontSize;
|
||||
}
|
||||
|
||||
drawList->PushClipRect(clipRectMin, clipRectMax, false);
|
||||
|
||||
DrawRubyAnnotatedText
|
||||
(
|
||||
g_seuratFont,
|
||||
fontSize,
|
||||
{ clipRectMin.x, clipRectMin.y },
|
||||
IM_COL32(255, 255, 255, 255 * textAlpha),
|
||||
clipRectMax.x - clipRectMin.x,
|
||||
{ textX, textY },
|
||||
lineMargin,
|
||||
descriptionText,
|
||||
0,
|
||||
clipRectMax.x - clipRectMin.x
|
||||
[=](const char* str, ImVec2 pos)
|
||||
{
|
||||
DrawTextBasic(g_seuratFont, fontSize, pos, IM_COL32(255, 255, 255, 255 * textAlpha), str);
|
||||
},
|
||||
[=](const char* str, float size, ImVec2 pos)
|
||||
{
|
||||
DrawTextBasic(g_seuratFont, size, pos, IM_COL32(255, 255, 255, 255 * textAlpha), str);
|
||||
}
|
||||
);
|
||||
|
||||
drawList->PopClipRect();
|
||||
|
||||
drawList->PopClipRect();
|
||||
|
||||
if (g_currentPage == WizardPage::InstallSucceeded)
|
||||
{
|
||||
auto hedgeDevStr = "hedge-dev";
|
||||
|
||||
Reference in New Issue
Block a user