29 #include "gui/viewport.h"
68 if ((sprite !=
nullptr) && (sprite->
sprite !=
nullptr))
95 if (mBackgroundImg !=
nullptr)
96 mBackgroundImg->setAlpha(mAlpha);
100 Font *
const font = getFont();
101 drawBackground(graphics);
103 unsigned sz =
CAST_U32(mEmoteImg.size());
106 for (
unsigned i = 0; i < sz; i++)
109 if (emoteImg !=
nullptr)
112 if (sprite !=
nullptr)
114 sprite->draw(graphics,
115 (i % mGridWidth) * mBoxWidth + mImageOffsetX,
116 (i / mGridWidth) * mBoxHeight + mImageOffsetY);
120 for (
unsigned i = 0; i < mMaxItems; i++)
122 const int emoteX = (i % mGridWidth) * mBoxWidth;
123 const int emoteY = (i / mGridWidth) * mBoxHeight;
133 emoteX + mTextOffsetX,
134 emoteY + mTextOffsetY);
137 BLOCK_END(
"EmoteShortcutContainer::draw")
148 if (mBackgroundImg !=
nullptr)
149 mBackgroundImg->setAlpha(mAlpha);
153 Font *
const font = getFont();
154 safeDrawBackground(graphics);
156 unsigned sz =
CAST_U32(mEmoteImg.size());
159 for (
unsigned i = 0; i < sz; i++)
162 if (emoteImg !=
nullptr)
165 if (sprite !=
nullptr)
167 sprite->draw(graphics,
168 (i % mGridWidth) * mBoxWidth + mImageOffsetX,
169 (i / mGridWidth) * mBoxHeight + mImageOffsetY);
173 for (
unsigned i = 0; i < mMaxItems; i++)
175 const int emoteX = (i % mGridWidth) * mBoxWidth;
176 const int emoteY = (i / mGridWidth) * mBoxHeight;
186 emoteX + mTextOffsetX,
187 emoteY + mTextOffsetY);
190 BLOCK_END(
"EmoteShortcutContainer::draw")
200 if (event.isConsumed())
208 const int index = getIndexFromGrid(event.getX(), event.getY());
222 mEmoteClicked =
true;
243 const int index = getIndexFromGrid(event.getX(), event.getY());
254 if (mEmoteMoved != 0U)
264 mEmoteClicked =
false;
273 const int index = getIndexFromGrid(event.getX(), event.getY());
280 if (
CAST_SIZE(index) < mEmoteImg.size() && (mEmoteImg[index] !=
nullptr))
284 strprintf(
"%s, %d", sprite->name.c_str(), sprite->id));
void widgetHidden(const Event &event)
void mousePressed(MouseEvent &event)
void mouseReleased(MouseEvent &event)
void draw(Graphics *graphics)
void setSkin(const Widget2 *const widget, Skin *const skin)
void mouseMoved(MouseEvent &event)
EmoteShortcutContainer(Widget2 *const widget)
std::vector< const EmoteSprite * > mEmoteImg
void safeDraw(Graphics *graphics)
void mouseExited(MouseEvent &event)
~EmoteShortcutContainer()
void mouseDragged(MouseEvent &event)
void setEmoteSelected(const unsigned char emoteId)
bool isEmoteSelected() const
void setEmotes(const size_t index, const unsigned char emoteId)
unsigned char getEmote(const size_t index) const
void setEmote(const size_t index)
void useEmote(const size_t index) const
void drawString(Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
virtual void setSkin(const Widget2 *const widget, Skin *const skin)
EmoteShortcut * emoteShortcut
static const int MAX_ITEMS
const int & getLast() A_CONST
const EmoteSprite * getSprite(const int id, const bool allowNull)
#define BLOCK_START(name)
std::string strprintf(const char *const format,...)
const AnimatedSprite * sprite