mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
feat: add buff expiry color warning on timer overlay
Buff/debuff countdown timers now change color as expiry approaches: white (>30s) → orange (<30s) → pulsing red (<10s). This gives players a clear visual cue to reapply important buffs before they fall off.
This commit is contained in:
parent
1b3dc52563
commit
f04a5c8f3e
1 changed files with 16 additions and 1 deletions
|
|
@ -8676,11 +8676,26 @@ void GameScreen::renderBuffBar(game::GameHandler& gameHandler) {
|
|||
ImVec2 textSize = ImGui::CalcTextSize(timeStr);
|
||||
float cx = iconMin.x + (iconMax.x - iconMin.x - textSize.x) * 0.5f;
|
||||
float cy = iconMax.y - textSize.y - 2.0f;
|
||||
// Choose timer color based on urgency
|
||||
ImU32 timerColor;
|
||||
if (remainMs < 10000) {
|
||||
// < 10s: pulse red
|
||||
float pulse = 0.7f + 0.3f * std::sin(
|
||||
static_cast<float>(ImGui::GetTime()) * 6.0f);
|
||||
timerColor = IM_COL32(
|
||||
static_cast<int>(255 * pulse),
|
||||
static_cast<int>(80 * pulse),
|
||||
static_cast<int>(60 * pulse), 255);
|
||||
} else if (remainMs < 30000) {
|
||||
timerColor = IM_COL32(255, 165, 0, 255); // orange
|
||||
} else {
|
||||
timerColor = IM_COL32(255, 255, 255, 255); // white
|
||||
}
|
||||
// Drop shadow for readability over any icon colour
|
||||
ImGui::GetWindowDrawList()->AddText(ImVec2(cx + 1, cy + 1),
|
||||
IM_COL32(0, 0, 0, 200), timeStr);
|
||||
ImGui::GetWindowDrawList()->AddText(ImVec2(cx, cy),
|
||||
IM_COL32(255, 255, 255, 255), timeStr);
|
||||
timerColor, timeStr);
|
||||
}
|
||||
|
||||
// Stack / charge count overlay — upper-left corner of the icon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue