diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-21 16:47:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-21 16:47:58 +0300 |
commit | aaddd74d15f8701283623b45a63262084055c291 (patch) | |
tree | a23dc5a98c9de25bf4db8ba2d0469ebc2c7c015a /src/gui/widgets | |
parent | aff65854a6301a74b098f376cd8ff83dd5f503d4 (diff) | |
download | mv-aaddd74d15f8701283623b45a63262084055c291.tar.gz mv-aaddd74d15f8701283623b45a63262084055c291.tar.bz2 mv-aaddd74d15f8701283623b45a63262084055c291.tar.xz mv-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
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/playerbox.cpp | 17 | ||||
-rw-r--r-- | src/gui/widgets/playerbox.h | 2 |
2 files changed, 15 insertions, 4 deletions
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 |