52static constexpr int ICON_SPACING = 3;
96 setVisible(stateIt !=
config.
windows.end() ? stateIt->second.visible.value_or(
true)
101 addMouseListener(
this);
109 const int tileWidth = game->getCurrentTileWidth();
110 const int tileHeight = game->getCurrentTileHeight();
112 int iconX =
mXpBar->getX() +
mXpBar->getWidth() + ICON_SPACING + tileWidth / 2;
113 int iconY = ICON_SPACING + tileHeight;
118 iconX - icon.sprite->
getWidth() / 2,
119 iconY - icon.sprite->getHeight());
120 iconX += ICON_SPACING + icon.sprite->getWidth();
130 int id =
event.getInt(
"id");
157 const int id =
event.getInt(
"index");
158 const bool newStatus =
event.getBool(
"newStatus");
164 effect->deliverMessage(newStatus);
165 effect->playSfx(newStatus);
167 Sprite *sprite = newStatus ? effect->getIconSprite() :
nullptr;
170 return icon.effectId == id;
215 std::string tooltip1;
216 std::string tooltip2;
222 tooltip1 =
strprintf(
"%u/%u", xp, xpNeeded);
223 tooltip2 =
strprintf(
"%s: %u",
_(
"Need"), xpNeeded - xp);
229 tooltip1 =
strprintf(
"%u/%u", hp, maxHp);
235 tooltip1 =
strprintf(
"%u/%u", mp, maxMp);
241 const int tileWidth = game->getCurrentTileWidth();
242 const int tileHeight = game->getCurrentTileHeight();
244 int iconX =
mXpBar->getX() +
mXpBar->getWidth() + ICON_SPACING + tileWidth / 2;
245 int iconY = ICON_SPACING + tileHeight;
249 int spriteX = iconX + icon.sprite->getOffsetX() - icon.sprite->getWidth() / 2;
250 int spriteY = iconY + icon.sprite->getOffsetY() - icon.sprite->getHeight();
252 if (
event.getX() >= spriteX &&
253 event.getX() < spriteX + icon.sprite->getWidth() &&
254 event.getY() >= spriteY &&
255 event.getY() < spriteY + icon.sprite->getHeight())
259 tooltip1 = effect->name;
263 iconX += ICON_SPACING + icon.sprite->getWidth();
267 if (tooltip1.empty())
274 event.getY() + getY(),
282 Popup::mouseExited(
event);
295 width += ICON_SPACING;
297 width += ICON_SPACING + icon.sprite->getWidth();
void listen(Event::Channel channel)
static Game * instance()
Provides access to the game instance.
A central point of control for graphics.
int getWidth() const
Returns the logical width of the screen.
~MiniStatusWindow() override
void mouseMoved(gcn::MouseEvent &mouseEvent) override
void mouseExited(gcn::MouseEvent &event) override
std::vector< StatusIcon > mStatusIcons
void drawIcons(Graphics *graphics)
void draw(gcn::Graphics *graphics) override
void event(Event::Channel channel, const Event &event) override
Animates a sprite by adding playback state.
static const StatusEffect * getStatusEffect(int id)
Retrieves a status effect.
static void updateMPBar(ProgressBar *bar, bool showMax=false)
static void updateHPBar(ProgressBar *bar, bool showMax=false)
static void updateXPBar(ProgressBar *bar, bool percent=true)
Config config
Global settings (config.xml)
ServerType getNetworkType()
GameHandler * getGameHandler()
PlayerHandler * getPlayerHandler()
int getAttribute(int id)
Returns the value of the given attribute.
unsigned deltaTimeMs()
The time in milliseconds since the last frame, but never more than 1000.
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.
std::map< std::string, WindowState > windows