summaryrefslogtreecommitdiff
path: root/src/gui/equipmentwindow.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-13 00:33:01 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-13 19:50:00 +0100
commita0973bc302f2972c4c70d973090c4d29ea2f7c6d (patch)
treee840f5807aa8b3cfc69b17a17ac3bf9cba317485 /src/gui/equipmentwindow.cpp
parent253c660d8e3341ad2d78658a23e599d5aaa84c00 (diff)
downloadmana-client-a0973bc302f2972c4c70d973090c4d29ea2f7c6d.tar.gz
mana-client-a0973bc302f2972c4c70d973090c4d29ea2f7c6d.tar.bz2
mana-client-a0973bc302f2972c4c70d973090c4d29ea2f7c6d.tar.xz
mana-client-a0973bc302f2972c4c70d973090c4d29ea2f7c6d.zip
Added background support to the equipment boxes.
The background images are auto-centered. Also, for Manaserv, a new background parameter has been added in the box node of the equip.xml file to specify the background image. Note that the filename is relative to the gui theme folder. Reviewed-by: Thorbjorn Lindeijer Resolves: TMW-Mantis #769.
Diffstat (limited to 'src/gui/equipmentwindow.cpp')
-rw-r--r--src/gui/equipmentwindow.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 209ecdb0..4e8eae4d 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -95,6 +95,15 @@ void EquipmentWindow::loadEquipBoxes()
Position boxPosition = Net::getInventoryHandler()->getBoxPosition(i);
mEquipBox[i].posX = boxPosition.x + getPadding();
mEquipBox[i].posY = boxPosition.y + getTitleBarHeight();
+
+ const std::string &backgroundFile =
+ Net::getInventoryHandler()->getBoxBackground(i);
+
+ if (!backgroundFile.empty())
+ {
+ mEquipBox[i].backgroundImage =
+ Theme::instance()->getImageFromTheme(backgroundFile);
+ }
}
}
@@ -117,6 +126,16 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
for (int i = 0; i < mBoxesNumber; i++)
{
+ // When there is a background image, draw it centered in the box:
+ if (mEquipBox[i].backgroundImage)
+ {
+ int posX = mEquipBox[i].posX
+ + (BOX_WIDTH - mEquipBox[i].backgroundImage->getWidth()) / 2;
+ int posY = mEquipBox[i].posY
+ + (BOX_HEIGHT - mEquipBox[i].backgroundImage->getHeight()) / 2;
+ g->drawImage(mEquipBox[i].backgroundImage, posX, posY);
+ }
+
if (i == mSelected)
{
const gcn::Color color = Theme::getThemeColor(Theme::HIGHLIGHT);