82 memset(mOutfit.items, -1,
sizeof(mOutfit.items));
90 std::stringstream ss(outfit.items);
103 std::string outfitStr;
106 bool emptyOutfit =
true;
110 if (!outfitStr.empty())
114 emptyOutfit &= item <= 0;
126 if (event.getId() ==
"next")
135 else if (event.getId() ==
"previous")
148 else if (event.getId() ==
"unequip")
187 graphics->drawRectangle(gcn::Rectangle(itemX, itemY,
191 graphics->fillRectangle(gcn::Rectangle(itemX, itemY,
207 g->drawImage(image, itemX, itemY);
217 const int tPosX =
mCursorPosX - (image->getWidth() / 2);
218 const int tPosY =
mCursorPosY - (image->getHeight() / 2);
220 g->drawImage(image, tPosX, tPosY);
230 if (event.getButton() == gcn::MouseEvent::LEFT)
279 if (event.getButton() == gcn::MouseEvent::LEFT)
303 const gcn::Rectangle tRect = gcn::Rectangle(
305 if (!tRect.isPointInRect(pointX, pointY))
320 for (
int i = 0; i < inventory->
getSize(); i++)
A central point of control for graphics.
void setColor(const gcn::Color &color) override
Defines a class for loading and storing images.
Item * findItem(int itemId) const
Searches for the specified item by it's id.
Item * getItem(int index) const
Returns the item at the specified index.
int getSize() const
Returns the size that this instance is configured for.
Represents one or more instances of a certain item type.
void doEvent(Event::Type eventType)
bool isEquipped() const
Returns whether this item is equipped.
int getQuantity() const
Returns the number of items.
int getId() const
Returns the item id.
Image * getImage() const
Returns the item image.
bool isEquippable() const
Returns whether this item is equippable.
void setRowHeight(int n, int h)
void setColWidth(int n, int w)
This class is an helper for setting the position of widgets.
@ AUTO_SET
Uses the share as the new size.
int getIndexFromGrid(int pointX, int pointY) const
void unequipNotInOutfit(int outfit)
void mouseReleased(gcn::MouseEvent &event) override
bool isItemSelected() const
void mouseDragged(gcn::MouseEvent &event) override
void wearOutfit(int outfit)
void mousePressed(gcn::MouseEvent &event) override
Outfit mOutfits[OUTFITS_COUNT]
void action(const gcn::ActionEvent &event) override
void copyOutfit(int outfit)
void draw(gcn::Graphics *graphics) override
void mouseReleased(gcn::MouseEvent &event) override
When the mouse button has been let go, this ensures that the mouse custom cursor is restored back to ...
void draw(gcn::Graphics *graphics) override
Draws the window contents.
Layout & getLayout()
Gets the layout handler for this window.
void setWindowName(const std::string &name)
Sets the name of the window.
void mouseDragged(gcn::MouseEvent &event) override
Implements window resizing and makes sure the window is not dragged/resized outside of the screen.
void setResizable(bool resize)
Sets whether or not the window can be resized.
LayoutCell & place(int x, int y, gcn::Widget *, int w=1, int h=1)
Adds a widget to the window and sets it at given cell.
void setCloseButton(bool flag)
Sets whether or not the window has a close button.
void setDefaultSize()
Set the default win pos and size to the current ones.
void loadWindowState()
Reads the position (and the size for resizable windows) in the configuration based on the given strin...
void mousePressed(gcn::MouseEvent &event) override
Starts window resizing when appropriate.
Config config
Global settings (config.xml)
Inventory * getInventory()
Returns the player's inventory.
constexpr int OUTFIT_ITEM_COUNT
constexpr int OUTFITS_COUNT
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.
std::string toString(const T &arg)
Converts the given value to a string using std::stringstream.
std::vector< Outfit > outfits
int items[OUTFIT_ITEM_COUNT]