summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-15 14:10:30 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-15 14:10:30 +0300
commitfc1347c730964ef9c0f331f120008c0e7a5fa07e (patch)
treec5d2f53e3459d80df10037c28ed2229090ea8204
parent3df38de8abe59281ede56b072ba0fe4684ef7b01 (diff)
downloadmanaverse-fc1347c730964ef9c0f331f120008c0e7a5fa07e.tar.gz
manaverse-fc1347c730964ef9c0f331f120008c0e7a5fa07e.tar.bz2
manaverse-fc1347c730964ef9c0f331f120008c0e7a5fa07e.tar.xz
manaverse-fc1347c730964ef9c0f331f120008c0e7a5fa07e.zip
fix onscreen controls position on resize/scale.
-rw-r--r--src/touchmanager.cpp10
-rw-r--r--src/touchmanager.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index 0b2b85562..c036f2594 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -52,6 +52,8 @@ TouchManager::TouchManager() :
mButtonsSize(1),
mJoystickSize(1),
mButtonsFormat(0),
+ mWidth(0),
+ mHeight(0),
mShow(false),
mInGame(false),
mTempHideButtons(false)
@@ -99,6 +101,8 @@ void TouchManager::init()
loadPad();
if (mShowButtons)
loadButtons();
+ mWidth = mainGraphics->mWidth;
+ mHeight = mainGraphics->mHeight;
}
void TouchManager::loadTouchItem(TouchItem **item, const std::string &name,
@@ -309,8 +313,8 @@ bool TouchManager::isActionActive(const int index) const
void TouchManager::resize(const int width, const int height)
{
mRedraw = true;
- const int maxHeight = mainGraphics->mHeight;
- const int diffW = width - mainGraphics->mWidth;
+ const int maxHeight = mHeight;
+ const int diffW = width - mWidth;
const int diffH = height - maxHeight;
FOR_EACH (TouchItemVectorCIter, it, mObjects)
{
@@ -340,6 +344,8 @@ void TouchManager::resize(const int width, const int height)
break;
}
}
+ mWidth = mainGraphics->mWidth;
+ mHeight = mainGraphics->mHeight;
}
void TouchManager::unload(TouchItem *const item)
diff --git a/src/touchmanager.h b/src/touchmanager.h
index f937c1129..6f7b96a6d 100644
--- a/src/touchmanager.h
+++ b/src/touchmanager.h
@@ -176,6 +176,8 @@ class TouchManager final : public ConfigListener
int mButtonsSize;
int mJoystickSize;
int mButtonsFormat;
+ int mWidth;
+ int mHeight;
bool mShow;
bool mInGame;
bool mTempHideButtons;