From 844a0002dc8278fa4616bac78d3d3d4e543713b2 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 12 Mar 2026 08:00:27 -0700 Subject: [PATCH] feat: improve combat text with drop shadows and larger crit size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch combat float text from ImGui::TextColored to draw list rendering for drop shadows on all entries (readability over complex backgrounds). Critical hit/heal events render at 1.35× normal font size for visual impact, matching the WoW combat feedback convention. --- src/ui/game_screen.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index a165cbba..9f8fdff7 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -6815,8 +6815,29 @@ void GameScreen::renderCombatText(game::GameHandler& gameHandler) { float baseX = outgoing ? outgoingX : incomingX; float xOffset = baseX + (idx % 3 - 1) * 60.0f; ++idx; + + // Crits render at 1.35× normal font size for visual impact + bool isCrit = (entry.type == game::CombatTextEntry::CRIT_DAMAGE || + entry.type == game::CombatTextEntry::CRIT_HEAL); + ImFont* font = ImGui::GetFont(); + float baseFontSize = ImGui::GetFontSize(); + float renderFontSize = isCrit ? baseFontSize * 1.35f : baseFontSize; + + // Advance cursor so layout accounting is correct, then read screen pos ImGui::SetCursorPos(ImVec2(xOffset, yOffset)); - ImGui::TextColored(color, "%s", text); + ImVec2 screenPos = ImGui::GetCursorScreenPos(); + + // Drop shadow for readability over complex backgrounds + ImU32 shadowCol = IM_COL32(0, 0, 0, static_cast(alpha * 180)); + ImU32 textCol = ImGui::ColorConvertFloat4ToU32(color); + ImDrawList* dl = ImGui::GetWindowDrawList(); + dl->AddText(font, renderFontSize, ImVec2(screenPos.x + 1.0f, screenPos.y + 1.0f), + shadowCol, text); + dl->AddText(font, renderFontSize, screenPos, textCol, text); + + // Reserve space so ImGui doesn't clip the window prematurely + ImVec2 ts = font->CalcTextSizeA(renderFontSize, FLT_MAX, 0.0f, text); + ImGui::Dummy(ts); } } ImGui::End();