diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-02-17 15:37:53 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-02-21 15:47:08 +0100 |
commit | 6e0681392282cce5fd1009d88b4a248e7f545f4c (patch) | |
tree | 757bd9d145bc4565310d2574caeb558258f5f626 /src/gui | |
parent | 0d47dfbb0f7425db9ec8d10f9d4efbbd7daa9f24 (diff) | |
download | mana-6e0681392282cce5fd1009d88b4a248e7f545f4c.tar.gz mana-6e0681392282cce5fd1009d88b4a248e7f545f4c.tar.bz2 mana-6e0681392282cce5fd1009d88b4a248e7f545f4c.tar.xz mana-6e0681392282cce5fd1009d88b4a248e7f545f4c.zip |
Replaced ImageSprite in Emote by plain Image
Emotes just need an image to be represented in the UI, so we don't need
to use ImageSprite.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/emotepopup.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 17 |
2 files changed, 20 insertions, 11 deletions
diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index 589d5087..a906eb7e 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -25,7 +25,6 @@ #include "configuration.h" #include "emoteshortcut.h" #include "graphics.h" -#include "imagesprite.h" #include "log.h" #include "resources/emotedb.h" @@ -60,6 +59,8 @@ EmotePopup::~EmotePopup() void EmotePopup::draw(gcn::Graphics *graphics) { + auto *g = static_cast<Graphics*>(graphics); + Popup::draw(graphics); const int emoteCount = EmoteDB::getEmoteCount(); @@ -81,13 +82,14 @@ void EmotePopup::draw(gcn::Graphics *graphics) // Draw selection image below hovered item if (i == mHoveredEmoteIndex) - { - static_cast<Graphics*>(graphics)->drawImage( - mSelectionImage, emoteX, emoteY + 4); - } + g->drawImage(mSelectionImage, emoteX, emoteY + 4); // Draw emote icon - EmoteDB::getByIndex(i).sprite->draw(static_cast<Graphics*>(graphics), emoteX, emoteY); + if (auto image = EmoteDB::getByIndex(i).image) + { + image->setAlpha(1.0f); + g->drawImage(image, emoteX, emoteY); + } } } diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 8ecbc9bf..d80cbb53 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -82,19 +82,26 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) int emoteId = emoteShortcut->getEmote(i); if (emoteId != -1) { - EmoteDB::get(emoteId).sprite->draw(g, emoteX + 2, emoteY + 10); + if (auto image = EmoteDB::get(emoteId).image) + { + image->setAlpha(1.0f); + g->drawImage(image, emoteX + 2, emoteY + 10); + } } } if (mEmoteMoved != -1) { // Draw the emote image being dragged by the cursor. - const ImageSprite *sprite = EmoteDB::get(mEmoteMoved).sprite.get(); + if (auto image = EmoteDB::get(mEmoteMoved).image) + { + image->setAlpha(1.0f); - const int tPosX = mCursorPosX - (sprite->getWidth() / 2); - const int tPosY = mCursorPosY - (sprite->getHeight() / 2); + const int tPosX = mCursorPosX - (image->getWidth() / 2); + const int tPosY = mCursorPosY - (image->getHeight() / 2); - sprite->draw(g, tPosX, tPosY); + g->drawImage(image, tPosX, tPosY); + } } } |