diff options
-rw-r--r-- | data/graphics/gui/selection.png | bin | 0 -> 1101 bytes | |||
-rw-r--r-- | src/gui/itemcontainer.cpp | 7 | ||||
-rw-r--r-- | src/gui/itemcontainer.h | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/data/graphics/gui/selection.png b/data/graphics/gui/selection.png Binary files differnew file mode 100644 index 00000000..8b80d59a --- /dev/null +++ b/data/graphics/gui/selection.png diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 723cb262..fa949c9a 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -23,7 +23,6 @@ #include "../main.h" #include "itemcontainer.h" -#include "../graphics.h" #include "../resources/resourcemanager.h" #include <sstream> @@ -34,6 +33,9 @@ ItemContainer::ItemContainer() if (!itemImg) logger.error("Unable to load items.png"); itemset = new Spriteset(itemImg, 20, 20); + selImg = resman->getImage("graphics/gui/selection.png", IMG_ALPHA); + if (!selImg) logger.error("Unable to load items.png"); + selectedItem = -1; /**< No item selected */ for (int i = 0; i < INVENTORY_SIZE; i++) { @@ -84,8 +86,7 @@ void ItemContainer::draw(gcn::Graphics* graphics) int itemX = (((selectedItem - 2) * 24) % (getWidth() - 24)); int itemY = (((selectedItem - 2) * 24) / (getWidth() - 24)) * 24; itemX -= itemX % 24; - graphics->drawRectangle(gcn::Rectangle(itemX, itemY, - 24, 24)); + selImg->draw(screen, x + itemX, y+itemY); } } diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index 0857ac9f..2cc0ed13 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -26,6 +26,7 @@ #include <iostream> #include <guichan.hpp> +#include "../graphics.h" #include "../resources/image.h" #include "../graphic/spriteset.h" @@ -48,6 +49,7 @@ class ItemContainer : public gcn::Widget private: Spriteset *itemset; + Image *selImg; int selectedItem; int itemNumber; ITEM_HOLDER items[INVENTORY_SIZE]; /**< this is the holder of items */ |