summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-16 21:28:47 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-16 21:28:47 +0300
commit286de530777fa72c2b2b743f629dbbb7a7f4c8a5 (patch)
treef133fa285138cdffb5872d04f430fc1c646462dd /src/client.cpp
parentc196a7329f0b05537bed8be834a510d7fd5c32f4 (diff)
downloadmv-286de530777fa72c2b2b743f629dbbb7a7f4c8a5.tar.gz
mv-286de530777fa72c2b2b743f629dbbb7a7f4c8a5.tar.bz2
mv-286de530777fa72c2b2b743f629dbbb7a7f4c8a5.tar.xz
mv-286de530777fa72c2b2b743f629dbbb7a7f4c8a5.zip
Add theming support for top right buttons before connecting to game.
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/client.cpp b/src/client.cpp
index a29147341..e281ddced 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -279,7 +279,10 @@ Client::Client(const Options &options) :
mInputFocused(true),
mMouseFocused(true),
mGuiAlpha(1.0f),
- mNewMessageFlag(false)
+ mNewMessageFlag(false),
+ mSkin(nullptr),
+ mButtonPadding(1),
+ mButtonSpacing(3)
{
mInstance = this;
}
@@ -884,8 +887,8 @@ int Client::testsExec() const
}
#define ADDBUTTON(var, object) var = object; \
- x -= var->getWidth() + 6; \
- var->setPosition(x, 0); \
+ x -= var->getWidth() + mButtonSpacing; \
+ var->setPosition(x, mButtonPadding); \
top->add(var);
@@ -900,6 +903,14 @@ int Client::gameExec()
SDL_Event event;
+ if (Theme::instance())
+ mSkin = Theme::instance()->load("windowmenu.xml", "");
+ if (mSkin)
+ {
+ mButtonPadding = mSkin->getPadding();
+ mButtonSpacing = mSkin->getOption("spacing", 3);
+ }
+
while (mState != STATE_EXIT)
{
PROFILER_START();
@@ -1099,7 +1110,7 @@ int Client::gameExec()
mDesktop = new Desktop(nullptr);
top->add(mDesktop);
- int x = top->getWidth();
+ int x = top->getWidth() - mButtonPadding;
ADDBUTTON(mSetupButton, new Button(mDesktop,
_("Setup"), "Setup", this))
#ifndef WIN32
@@ -2697,20 +2708,20 @@ void Client::resizeVideo(int width, int height, const bool always)
if (mSetupButton)
{
- int x = width - mSetupButton->getWidth() - 3;
- mSetupButton->setPosition(x, 3);
+ int x = width - mSetupButton->getWidth() - mButtonPadding;
+ mSetupButton->setPosition(x, mButtonPadding);
#ifndef WIN32
- x -= mPerfomanceButton->getWidth() + 6;
- mPerfomanceButton->setPosition(x, 3);
+ x -= mPerfomanceButton->getWidth() + mButtonSpacing;
+ mPerfomanceButton->setPosition(x, mButtonPadding);
- x -= mVideoButton->getWidth() + 6;
- mVideoButton->setPosition(x, 3);
+ x -= mVideoButton->getWidth() + mButtonSpacing;
+ mVideoButton->setPosition(x, mButtonPadding);
- x -= mThemesButton->getWidth() + 6;
- mThemesButton->setPosition(x, 3);
+ x -= mThemesButton->getWidth() + mButtonSpacing;
+ mThemesButton->setPosition(x, mButtonPadding);
#ifdef ANDROID
- x -= mCloseButton->getWidth() + 6;
- mCloseButton->setPosition(x, 3);
+ x -= mCloseButton->getWidth() + mButtonSpacing;
+ mCloseButton->setPosition(x, mButtonPadding);
#endif
#endif
}