summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-21 16:47:58 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-21 16:47:58 +0300
commitaaddd74d15f8701283623b45a63262084055c291 (patch)
treea23dc5a98c9de25bf4db8ba2d0469ebc2c7c015a
parentaff65854a6301a74b098f376cd8ff83dd5f503d4 (diff)
downloadManaVerse-aaddd74d15f8701283623b45a63262084055c291.tar.gz
ManaVerse-aaddd74d15f8701283623b45a63262084055c291.tar.bz2
ManaVerse-aaddd74d15f8701283623b45a63262084055c291.tar.xz
ManaVerse-aaddd74d15f8701283623b45a63262084055c291.zip
Extend playerbox theming.
New theme options: offsetX - offset for player by x. Default -16 offsetY - offset for player by y. Default -32 frameSize - frame size. Default 2
-rw-r--r--data/graphics/gui/charcreate_playerbox.xml32
-rw-r--r--data/graphics/gui/equipment_playerbox.xml32
-rw-r--r--data/graphics/gui/playerbox.xml34
-rw-r--r--data/themes/jewelry/playerbox.xml36
-rw-r--r--src/gui/widgets/playerbox.cpp17
-rw-r--r--src/gui/widgets/playerbox.h2
6 files changed, 90 insertions, 63 deletions
diff --git a/data/graphics/gui/charcreate_playerbox.xml b/data/graphics/gui/charcreate_playerbox.xml
index 7a8b829f8..72ed13a7c 100644
--- a/data/graphics/gui/charcreate_playerbox.xml
+++ b/data/graphics/gui/charcreate_playerbox.xml
@@ -1,18 +1,22 @@
<skinset name="Default" image="window.png">
- <widget type="Window" xpos="75" ypos="186">
- <!-- Top Row -->
- <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" />
- <part type="top-edge" xpos="3" ypos="0" width="26" height="4" />
- <part type="top-right-corner" xpos="28" ypos="0" width="4" height="4" />
+ <widget type="Window" xpos="75" ypos="186">
+ <option name="offsetX" value="-16" />
+ <option name="offsetY" value="-32" />
+ <option name="frameSize" value="2" />
- <!-- Middle Row -->
- <part type="left-edge" xpos="0" ypos="3" width="4" height="26" />
- <part type="bg-quad" xpos="3" ypos="3" width="26" height="26" />
- <part type="right-edge" xpos="28" ypos="3" width="4" height="26" />
+ <!-- Top Row -->
+ <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" />
+ <part type="top-edge" xpos="3" ypos="0" width="26" height="4" />
+ <part type="top-right-corner" xpos="28" ypos="0" width="4" height="4" />
- <!-- Bottom Row -->
- <part type="bottom-left-corner" xpos="0" ypos="28" width="4" height="4" />
- <part type="bottom-edge" xpos="3" ypos="28" width="26" height="4" />
- <part type="bottom-right-corner" xpos="28" ypos="28" width="4" height="4" />
- </widget>
+ <!-- Middle Row -->
+ <part type="left-edge" xpos="0" ypos="3" width="4" height="26" />
+ <part type="bg-quad" xpos="3" ypos="3" width="26" height="26" />
+ <part type="right-edge" xpos="28" ypos="3" width="4" height="26" />
+
+ <!-- Bottom Row -->
+ <part type="bottom-left-corner" xpos="0" ypos="28" width="4" height="4" />
+ <part type="bottom-edge" xpos="3" ypos="28" width="26" height="4" />
+ <part type="bottom-right-corner" xpos="28" ypos="28" width="4" height="4" />
+ </widget>
</skinset>
diff --git a/data/graphics/gui/equipment_playerbox.xml b/data/graphics/gui/equipment_playerbox.xml
index 7a8b829f8..72ed13a7c 100644
--- a/data/graphics/gui/equipment_playerbox.xml
+++ b/data/graphics/gui/equipment_playerbox.xml
@@ -1,18 +1,22 @@
<skinset name="Default" image="window.png">
- <widget type="Window" xpos="75" ypos="186">
- <!-- Top Row -->
- <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" />
- <part type="top-edge" xpos="3" ypos="0" width="26" height="4" />
- <part type="top-right-corner" xpos="28" ypos="0" width="4" height="4" />
+ <widget type="Window" xpos="75" ypos="186">
+ <option name="offsetX" value="-16" />
+ <option name="offsetY" value="-32" />
+ <option name="frameSize" value="2" />
- <!-- Middle Row -->
- <part type="left-edge" xpos="0" ypos="3" width="4" height="26" />
- <part type="bg-quad" xpos="3" ypos="3" width="26" height="26" />
- <part type="right-edge" xpos="28" ypos="3" width="4" height="26" />
+ <!-- Top Row -->
+ <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" />
+ <part type="top-edge" xpos="3" ypos="0" width="26" height="4" />
+ <part type="top-right-corner" xpos="28" ypos="0" width="4" height="4" />
- <!-- Bottom Row -->
- <part type="bottom-left-corner" xpos="0" ypos="28" width="4" height="4" />
- <part type="bottom-edge" xpos="3" ypos="28" width="26" height="4" />
- <part type="bottom-right-corner" xpos="28" ypos="28" width="4" height="4" />
- </widget>
+ <!-- Middle Row -->
+ <part type="left-edge" xpos="0" ypos="3" width="4" height="26" />
+ <part type="bg-quad" xpos="3" ypos="3" width="26" height="26" />
+ <part type="right-edge" xpos="28" ypos="3" width="4" height="26" />
+
+ <!-- Bottom Row -->
+ <part type="bottom-left-corner" xpos="0" ypos="28" width="4" height="4" />
+ <part type="bottom-edge" xpos="3" ypos="28" width="26" height="4" />
+ <part type="bottom-right-corner" xpos="28" ypos="28" width="4" height="4" />
+ </widget>
</skinset>
diff --git a/data/graphics/gui/playerbox.xml b/data/graphics/gui/playerbox.xml
index 5fc994df5..7e8a91482 100644
--- a/data/graphics/gui/playerbox.xml
+++ b/data/graphics/gui/playerbox.xml
@@ -1,19 +1,23 @@
<skinset name="Default" image="window.png">
- <widget type="Window" xpos="41" ypos="186">
- <option name="drawbackground" value="1" />
- <!-- Top Row -->
- <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" />
- <part type="top-edge" xpos="3" ypos="0" width="26" height="4" />
- <part type="top-right-corner" xpos="28" ypos="0" width="4" height="4" />
+ <widget type="Window" xpos="41" ypos="186">
+ <option name="drawbackground" value="1" />
+ <option name="offsetX" value="-16" />
+ <option name="offsetY" value="-32" />
+ <option name="frameSize" value="2" />
- <!-- Middle Row -->
- <part type="left-edge" xpos="0" ypos="3" width="4" height="26" />
- <part type="bg-quad" xpos="3" ypos="3" width="26" height="26" />
- <part type="right-edge" xpos="28" ypos="3" width="4" height="26" />
+ <!-- Top Row -->
+ <part type="top-left-corner" xpos="0" ypos="0" width="4" height="4" />
+ <part type="top-edge" xpos="3" ypos="0" width="26" height="4" />
+ <part type="top-right-corner" xpos="28" ypos="0" width="4" height="4" />
- <!-- Bottom Row -->
- <part type="bottom-left-corner" xpos="0" ypos="28" width="4" height="4" />
- <part type="bottom-edge" xpos="3" ypos="28" width="26" height="4" />
- <part type="bottom-right-corner" xpos="28" ypos="28" width="4" height="4" />
- </widget>
+ <!-- Middle Row -->
+ <part type="left-edge" xpos="0" ypos="3" width="4" height="26" />
+ <part type="bg-quad" xpos="3" ypos="3" width="26" height="26" />
+ <part type="right-edge" xpos="28" ypos="3" width="4" height="26" />
+
+ <!-- Bottom Row -->
+ <part type="bottom-left-corner" xpos="0" ypos="28" width="4" height="4" />
+ <part type="bottom-edge" xpos="3" ypos="28" width="26" height="4" />
+ <part type="bottom-right-corner" xpos="28" ypos="28" width="4" height="4" />
+ </widget>
</skinset>
diff --git a/data/themes/jewelry/playerbox.xml b/data/themes/jewelry/playerbox.xml
index 1e18e42fe..8b9b1b412 100644
--- a/data/themes/jewelry/playerbox.xml
+++ b/data/themes/jewelry/playerbox.xml
@@ -1,19 +1,23 @@
<skinset name="Default" image="window.png">
- <widget type="Window" xpos="41" ypos="186">
- <option name="drawbackground" value="1" />
- <!-- Top Row -->
- <part type="top-left-corner" xpos="0" ypos="0" width="5" height="5" />
- <part type="top-edge" xpos="5" ypos="0" width="20" height="5" />
- <part type="top-right-corner" xpos="27" ypos="0" width="5" height="5" />
+ <widget type="Window" xpos="41" ypos="186">
+ <option name="drawbackground" value="1" />
+ <option name="offsetX" value="-16" />
+ <option name="offsetY" value="-32" />
+ <option name="frameSize" value="2" />
- <!-- Middle Row -->
- <part type="left-edge" xpos="0" ypos="5" width="5" height="20" />
- <part type="bg-quad" xpos="5" ypos="5" width="20" height="20" />
- <part type="right-edge" xpos="27" ypos="5" width="5" height="20" />
-
- <!-- Bottom Row -->
- <part type="bottom-left-corner" xpos="0" ypos="27" width="5" height="5" />
- <part type="bottom-edge" xpos="5" ypos="27" width="20" height="5" />
- <part type="bottom-right-corner" xpos="27" ypos="27" width="5" height="5" />
- </widget>
+ <!-- Top Row -->
+ <part type="top-left-corner" xpos="0" ypos="0" width="5" height="5" />
+ <part type="top-edge" xpos="5" ypos="0" width="20" height="5" />
+ <part type="top-right-corner" xpos="27" ypos="0" width="5" height="5" />
+
+ <!-- Middle Row -->
+ <part type="left-edge" xpos="0" ypos="5" width="5" height="20" />
+ <part type="bg-quad" xpos="5" ypos="5" width="20" height="20" />
+ <part type="right-edge" xpos="27" ypos="5" width="5" height="20" />
+
+ <!-- Bottom Row -->
+ <part type="bottom-left-corner" xpos="0" ypos="27" width="5" height="5" />
+ <part type="bottom-edge" xpos="5" ypos="27" width="20" height="5" />
+ <part type="bottom-right-corner" xpos="27" ypos="27" width="5" height="5" />
+ </widget>
</skinset>
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 7fbe68f7f..747cd91ab 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -39,7 +39,9 @@ PlayerBox::PlayerBox(Being *const being, const std::string &skin) :
mBeing(being),
mAlpha(1.0),
mSkin(nullptr),
- mDrawBackground(false)
+ mDrawBackground(false),
+ mOffsetX(-16),
+ mOffsetY(-32)
{
init(skin);
}
@@ -49,7 +51,9 @@ PlayerBox::PlayerBox(std::string skin) :
mBeing(nullptr),
mAlpha(1.0),
mSkin(nullptr),
- mDrawBackground(false)
+ mDrawBackground(false),
+ mOffsetX(-16),
+ mOffsetY(-32)
{
init(skin);
}
@@ -77,7 +81,12 @@ void PlayerBox::init(std::string skin)
mSkin = Theme::instance()->loadSkinRect(mBackground,
skin, "playerbox_background.xml");
if (mSkin)
+ {
mDrawBackground = (mSkin->getOption("drawbackground") != 0);
+ mOffsetX = mSkin->getOption("offsetX", -16);
+ mOffsetY = mSkin->getOption("offsetY", -32);
+ mFrameSize = mSkin->getOption("frameSize", 2);
+ }
}
else
{
@@ -92,8 +101,8 @@ void PlayerBox::draw(gcn::Graphics *graphics)
{
// Draw character
const int bs = getFrameSize();
- const int x = getWidth() / 2 + bs - 16;
- const int y = getHeight() - bs - 32;
+ const int x = getWidth() / 2 + bs + mOffsetX;
+ const int y = getHeight() - bs + mOffsetY;
mBeing->drawSpriteAt(static_cast<Graphics*>(graphics), x, y);
}
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index 90ef929af..d7729f5be 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -87,6 +87,8 @@ class PlayerBox final : public Widget2,
ImageRect mBackground;
Skin *mSkin;
bool mDrawBackground;
+ int mOffsetX;
+ int mOffsetY;
};
#endif