mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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.
This commit is contained in:
parent
8858edde05
commit
8cba8033ba
1 changed files with 20 additions and 0 deletions
|
|
@ -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<float>(restedXp) / static_cast<float>(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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue