From e6c5881854c16dd9f84ab23012739a27335edd03 Mon Sep 17 00:00:00 2001 From: Hash Borgir Date: Wed, 24 Apr 2024 16:36:37 -0600 Subject: [PATCH] bars centered, don't like it, going back to orbs --- .../modules/autosort/autosort_client.cpp | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/d2tweaks/client/modules/autosort/autosort_client.cpp b/src/d2tweaks/client/modules/autosort/autosort_client.cpp index 6cede75..0fdda36 100644 --- a/src/d2tweaks/client/modules/autosort/autosort_client.cpp +++ b/src/d2tweaks/client/modules/autosort/autosort_client.cpp @@ -342,19 +342,30 @@ public: float manaPercentage = static_cast(statMana) / static_cast(statMaxMana); float staminaPercentage = static_cast(statStamina) / static_cast(statMaxStamina); + + int sHeight = 768; + int sWidth = 1280; + + int sHCenter = sHeight / 2; + int sWCenter = sWidth / 2; + // Define the dimensions for the bars int barWidth = 200; // Width of the bars int barHeight = 16; // Height of the bars // Define the coordinates for the bars - int barX = 245; // Left coordinate of the bars - int barY_HP = 728; // Top coordinate of the HP bar + int barX = sWCenter - 100; // Left coordinate of the bars + int barY_HP = 654; // Top coordinate of the HP bar int barY_Mana = barY_HP + barHeight + 4; // Top coordinate of the Mana bar with separator int barY_Stamina = barY_Mana + barHeight + 4; // Top coordinate of the Stamina bar with separator - std::wstring life = strHP + L" / " + strMaxHP; - std::wstring mana = strMana + L" / " + strMaxMana; - std::wstring stamina = strStamina + L" / " + strMaxStamina; + std::wstring life = L"L: " + strHP + L" / " + strMaxHP; + std::wstring mana = L"M: " + strMana + L" / " + strMaxMana; + std::wstring stamina = L"" + strStamina + L" / " + strMaxStamina; + + int lifeWidth = diablo2::d2_win::get_text_pixel_width(const_cast(life.c_str())); + int manaWidth = diablo2::d2_win::get_text_pixel_width(const_cast(mana.c_str())); + int staminaWidth = diablo2::d2_win::get_text_pixel_width(const_cast(stamina.c_str())); // Calculate the filled widths of the bars @@ -367,15 +378,12 @@ public: // Draw the filled HP bar diablo2::d2_gfx::draw_filled_rect(barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, 10, 255); //DrawFilledRect(diabloIIWnd, barX, barY_HP, barX + filledHPWidth, barY_HP + barHeight, RGB(255, 0, 0)); // Red color for HP - diablo2::d2_win::draw_text(const_cast(life.c_str()), barX + 20, barY_HP + 15, stat.colorStatValue, 0); - - - + diablo2::d2_win::draw_text(const_cast(life.c_str()), sWCenter - (lifeWidth/2), barY_HP + 15, diablo2::ui_color_t::UI_COLOR_GOLD, 0); // Draw the filled Mana bar diablo2::d2_gfx::draw_filled_rect(barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, 156, 255); //DrawFilledRect(diabloIIWnd, barX, barY_Mana, barX + filledManaWidth, barY_Mana + barHeight, RGB(100, 100, 255)); // Blue color for Mana - diablo2::d2_win::draw_text(const_cast(mana.c_str()), barX + 20, barY_Mana + 15, stat.colorStatValue, 0); + diablo2::d2_win::draw_text(const_cast(mana.c_str()), sWCenter - (lifeWidth / 2), barY_Mana + 15, diablo2::ui_color_t::UI_COLOR_DARK_WHITE, 0); /* // Define the number of separators