summaryrefslogtreecommitdiff
path: root/src/touchmanager.cpp
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 /src/touchmanager.cpp
parent3df38de8abe59281ede56b072ba0fe4684ef7b01 (diff)
downloadmanaplus-fc1347c730964ef9c0f331f120008c0e7a5fa07e.tar.gz
manaplus-fc1347c730964ef9c0f331f120008c0e7a5fa07e.tar.bz2
manaplus-fc1347c730964ef9c0f331f120008c0e7a5fa07e.tar.xz
manaplus-fc1347c730964ef9c0f331f120008c0e7a5fa07e.zip
fix onscreen controls position on resize/scale.
Diffstat (limited to 'src/touchmanager.cpp')
-rw-r--r--src/touchmanager.cpp10
1 files changed, 8 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)