From 3460d887d1fd689cd9e8b36866bc467df4e2f4a4 Mon Sep 17 00:00:00 2001 From: DeaTh-G Date: Sat, 25 Jan 2025 17:30:24 +0100 Subject: [PATCH] remove wrapper function --- UnleashedRecomp/ui/imgui_utils.cpp | 5 ----- UnleashedRecomp/ui/imgui_utils.h | 3 +-- UnleashedRecomp/ui/message_window.cpp | 6 ++++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/UnleashedRecomp/ui/imgui_utils.cpp b/UnleashedRecomp/ui/imgui_utils.cpp index 7a8aae66..12859b62 100644 --- a/UnleashedRecomp/ui/imgui_utils.cpp +++ b/UnleashedRecomp/ui/imgui_utils.cpp @@ -617,11 +617,6 @@ void DrawRubyAnnotatedText(const ImFont* font, float fontSize, float maxWidth, c } } -void DrawCentredParagraph(const ImFont* font, float fontSize, float maxWidth, const ImVec2& centre, float lineMargin, const char* text, std::function drawMethod) -{ - DrawRubyAnnotatedText(font, fontSize, maxWidth, centre, lineMargin, text, drawMethod, annotationDrawMethod, true); -} - float Lerp(float a, float b, float t) { return a + (b - a) * t; diff --git a/UnleashedRecomp/ui/imgui_utils.h b/UnleashedRecomp/ui/imgui_utils.h index 1c99b173..faaa9ab5 100644 --- a/UnleashedRecomp/ui/imgui_utils.h +++ b/UnleashedRecomp/ui/imgui_utils.h @@ -26,7 +26,7 @@ struct TextSegment { }; struct Paragraph { - bool annotated; + bool annotated = false; std::vector> lines; }; @@ -68,7 +68,6 @@ std::string RemoveAnnotationFromParagraphLine(const std::vector& an ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float lineMargin, std::vector lines); ImVec2 MeasureCentredParagraph(const ImFont* font, float fontSize, float maxWidth, float lineMargin, const char* text); void DrawRubyAnnotatedText(const ImFont* font, float fontSize, float maxWidth, const ImVec2& pos, float lineMargin, const char* text, std::function drawMethod, std::function annotationDrawMethod, bool isCentred = false); -void DrawCentredParagraph(const ImFont* font, float fontSize, float maxWidth, const ImVec2& centre, float lineMargin, const char* text, std::function drawMethod); float Lerp(float a, float b, float t); float Cubic(float a, float b, float t); float Hermite(float a, float b, float t); diff --git a/UnleashedRecomp/ui/message_window.cpp b/UnleashedRecomp/ui/message_window.cpp index d67534ce..528bc004 100644 --- a/UnleashedRecomp/ui/message_window.cpp +++ b/UnleashedRecomp/ui/message_window.cpp @@ -307,7 +307,7 @@ void MessageWindow::Draw() if (DrawContainer(g_appearTime, centre, { textSize.x / 2 + textMarginX, textSize.y / 2 + textMarginY }, !g_isControlsVisible)) { - DrawCentredParagraph + DrawRubyAnnotatedText ( g_fntSeurat, fontSize, @@ -323,7 +323,9 @@ void MessageWindow::Draw() [=](const char* str, float size, ImVec2 pos) { DrawTextWithShadow(g_fntSeurat, size, pos, IM_COL32(255, 255, 255, 255), str); - } + }, + + true ); drawList->PopClipRect();