mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
fix: move buff bar to top-right, split buffs/debuffs, raise aura cap to 40
- Relocates buff bar from top-left Y=145 (overlapping party frames) to top-right (screenW - barW - 10, 140) where it doesn't conflict with party/raid frames anchored on the left side - Increases max shown auras from 16 to 40 (WotLK supports 48 slots) - Two-pass rendering: buffs shown first, debuffs below with a spacing gap between them; both still use green/red borders for visual distinction - Widens row to 12 icons for better horizontal use of screen space
This commit is contained in:
parent
5fbeb7938c
commit
a7474b96cf
1 changed files with 22 additions and 10 deletions
|
|
@ -6602,12 +6602,14 @@ void GameScreen::renderBuffBar(game::GameHandler& gameHandler) {
|
||||||
|
|
||||||
auto* assetMgr = core::Application::getInstance().getAssetManager();
|
auto* assetMgr = core::Application::getInstance().getAssetManager();
|
||||||
|
|
||||||
// Position below the player frame in top-left
|
// Position in top-right to avoid overlapping the party frame on the left
|
||||||
constexpr float ICON_SIZE = 32.0f;
|
constexpr float ICON_SIZE = 32.0f;
|
||||||
constexpr int ICONS_PER_ROW = 8;
|
constexpr int ICONS_PER_ROW = 12;
|
||||||
float barW = ICONS_PER_ROW * (ICON_SIZE + 4.0f) + 8.0f;
|
float barW = ICONS_PER_ROW * (ICON_SIZE + 4.0f) + 8.0f;
|
||||||
// Dock under player frame in top-left (player frame is at 10, 30 with ~110px height)
|
ImVec2 displaySize = ImGui::GetIO().DisplaySize;
|
||||||
ImGui::SetNextWindowPos(ImVec2(10.0f, 145.0f), ImGuiCond_Always);
|
float screenW = displaySize.x > 0.0f ? displaySize.x : 1280.0f;
|
||||||
|
// Anchor to top-right, below minimap area (~140px from top)
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(screenW - barW - 10.0f, 140.0f), ImGuiCond_Always);
|
||||||
ImGui::SetNextWindowSize(ImVec2(barW, 0), ImGuiCond_Always);
|
ImGui::SetNextWindowSize(ImVec2(barW, 0), ImGuiCond_Always);
|
||||||
|
|
||||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
|
ImGuiWindowFlags flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
|
||||||
|
|
@ -6618,16 +6620,22 @@ void GameScreen::renderBuffBar(game::GameHandler& gameHandler) {
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.0f, 2.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.0f, 2.0f));
|
||||||
|
|
||||||
if (ImGui::Begin("##BuffBar", nullptr, flags)) {
|
if (ImGui::Begin("##BuffBar", nullptr, flags)) {
|
||||||
int shown = 0;
|
// Separate buffs and debuffs; show buffs first, then debuffs with a visual gap
|
||||||
for (size_t i = 0; i < auras.size() && shown < 16; ++i) {
|
// Render one pass for buffs, one for debuffs
|
||||||
|
for (int pass = 0; pass < 2; ++pass) {
|
||||||
|
bool wantBuff = (pass == 0);
|
||||||
|
int shown = 0;
|
||||||
|
for (size_t i = 0; i < auras.size() && shown < 40; ++i) {
|
||||||
const auto& aura = auras[i];
|
const auto& aura = auras[i];
|
||||||
if (aura.isEmpty()) continue;
|
if (aura.isEmpty()) continue;
|
||||||
|
|
||||||
|
bool isBuff = (aura.flags & 0x80) == 0; // 0x80 = negative/debuff flag
|
||||||
|
if (isBuff != wantBuff) continue; // only render matching pass
|
||||||
|
|
||||||
if (shown > 0 && shown % ICONS_PER_ROW != 0) ImGui::SameLine();
|
if (shown > 0 && shown % ICONS_PER_ROW != 0) ImGui::SameLine();
|
||||||
|
|
||||||
ImGui::PushID(static_cast<int>(i));
|
ImGui::PushID(static_cast<int>(i) + (pass * 256));
|
||||||
|
|
||||||
bool isBuff = (aura.flags & 0x80) == 0; // 0x80 = negative/debuff flag
|
|
||||||
ImVec4 borderColor = isBuff ? ImVec4(0.2f, 0.8f, 0.2f, 0.9f) : ImVec4(0.8f, 0.2f, 0.2f, 0.9f);
|
ImVec4 borderColor = isBuff ? ImVec4(0.2f, 0.8f, 0.2f, 0.9f) : ImVec4(0.8f, 0.2f, 0.2f, 0.9f);
|
||||||
|
|
||||||
// Try to get spell icon
|
// Try to get spell icon
|
||||||
|
|
@ -6722,10 +6730,14 @@ void GameScreen::renderBuffBar(game::GameHandler& gameHandler) {
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
shown++;
|
shown++;
|
||||||
}
|
} // end aura loop
|
||||||
|
// Add visual gap between buffs and debuffs
|
||||||
|
if (pass == 0 && shown > 0) ImGui::Spacing();
|
||||||
|
} // end pass loop
|
||||||
|
|
||||||
// Dismiss Pet button
|
// Dismiss Pet button
|
||||||
if (gameHandler.hasPet()) {
|
if (gameHandler.hasPet()) {
|
||||||
if (shown > 0) ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.6f, 0.2f, 0.2f, 0.9f));
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.6f, 0.2f, 0.2f, 0.9f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.3f, 0.3f, 1.0f));
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.3f, 0.3f, 1.0f));
|
||||||
if (ImGui::Button("Dismiss Pet", ImVec2(-1, 0))) {
|
if (ImGui::Button("Dismiss Pet", ImVec2(-1, 0))) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue