From 8cba8033baeede08531b37eb4f5941bbde84bbcb Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 12 Mar 2026 07:12:02 -0700 Subject: [PATCH] feat: add tooltip to XP bar showing XP to level and rested details Hovering the XP bar now shows a breakdown: current XP, XP remaining to the next level, rested bonus amount in XP and as a percentage of a full level, and whether the player is currently resting. --- src/ui/game_screen.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 9295f71a..0d5ce1eb 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -6147,6 +6147,26 @@ void GameScreen::renderXpBar(game::GameHandler& gameHandler) { drawList->AddText(ImVec2(tx, ty), IM_COL32(230, 230, 230, 255), overlay); ImGui::Dummy(barSize); + + // Tooltip with XP-to-level and rested details + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + uint32_t xpToLevel = (currentXp < nextLevelXp) ? (nextLevelXp - currentXp) : 0; + ImGui::TextColored(ImVec4(0.9f, 0.85f, 1.0f, 1.0f), "Experience"); + ImGui::Separator(); + ImGui::Text("Current: %u / %u XP", currentXp, nextLevelXp); + ImGui::Text("To next level: %u XP", xpToLevel); + if (restedXp > 0) { + float restedLevels = static_cast(restedXp) / static_cast(nextLevelXp); + ImGui::Spacing(); + ImGui::TextColored(ImVec4(0.78f, 0.60f, 1.0f, 1.0f), + "Rested: +%u XP (%.1f%% of a level)", restedXp, restedLevels * 100.0f); + if (isResting) + ImGui::TextColored(ImVec4(0.6f, 0.9f, 0.6f, 1.0f), + "Resting — accumulating bonus XP"); + } + ImGui::EndTooltip(); + } } ImGui::End();