mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
feat: show spell icon in cast bar alongside progress bar
Display the casting spell's icon (20×20) to the left of the progress bar using the existing getSpellIcon DBC lookup. Falls back gracefully to the icon-less layout when no icon is available (e.g. before DBC load or for unknown spells).
This commit is contained in:
parent
d9ce056e13
commit
6cd8dc0d9d
1 changed files with 15 additions and 2 deletions
|
|
@ -6301,10 +6301,16 @@ void GameScreen::renderRepBar(game::GameHandler& gameHandler) {
|
|||
void GameScreen::renderCastBar(game::GameHandler& gameHandler) {
|
||||
if (!gameHandler.isCasting()) return;
|
||||
|
||||
auto* assetMgr = core::Application::getInstance().getAssetManager();
|
||||
|
||||
ImVec2 displaySize = ImGui::GetIO().DisplaySize;
|
||||
float screenW = displaySize.x > 0.0f ? displaySize.x : 1280.0f;
|
||||
float screenH = displaySize.y > 0.0f ? displaySize.y : 720.0f;
|
||||
|
||||
uint32_t currentSpellId = gameHandler.getCurrentCastSpellId();
|
||||
VkDescriptorSet iconTex = (currentSpellId != 0 && assetMgr)
|
||||
? getSpellIcon(currentSpellId, assetMgr) : VK_NULL_HANDLE;
|
||||
|
||||
float barW = 300.0f;
|
||||
float barX = (screenW - barW) / 2.0f;
|
||||
float barY = screenH - 120.0f;
|
||||
|
|
@ -6332,7 +6338,6 @@ void GameScreen::renderCastBar(game::GameHandler& gameHandler) {
|
|||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, barColor);
|
||||
|
||||
char overlay[64];
|
||||
uint32_t currentSpellId = gameHandler.getCurrentCastSpellId();
|
||||
if (currentSpellId == 0) {
|
||||
snprintf(overlay, sizeof(overlay), "Opening... (%.1fs)", gameHandler.getCastTimeRemaining());
|
||||
} else {
|
||||
|
|
@ -6343,7 +6348,15 @@ void GameScreen::renderCastBar(game::GameHandler& gameHandler) {
|
|||
else
|
||||
snprintf(overlay, sizeof(overlay), "%s... (%.1fs)", verb, gameHandler.getCastTimeRemaining());
|
||||
}
|
||||
ImGui::ProgressBar(progress, ImVec2(-1, 20), overlay);
|
||||
|
||||
if (iconTex) {
|
||||
// Spell icon to the left of the progress bar
|
||||
ImGui::Image((ImTextureID)(uintptr_t)iconTex, ImVec2(20, 20));
|
||||
ImGui::SameLine(0, 4);
|
||||
ImGui::ProgressBar(progress, ImVec2(-1, 20), overlay);
|
||||
} else {
|
||||
ImGui::ProgressBar(progress, ImVec2(-1, 20), overlay);
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::End();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue