diff options
-rw-r--r-- | src/gui/setup.cpp | 23 | ||||
-rw-r--r-- | src/gui/setup.h | 2 | ||||
-rw-r--r-- | src/touchmanager.cpp | 18 | ||||
-rw-r--r-- | src/touchmanager.h | 4 |
4 files changed, 27 insertions, 20 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 9677e052a..ab7179257 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -26,6 +26,7 @@ #include "configuration.h" #include "game.h" #include "main.h" +#include "touchmanager.h" #include "gui/setup_audio.h" #include "gui/setup_chat.h" @@ -209,22 +210,12 @@ void Setup::activateTab(const std::string &name) { std::string tmp = gettext(name.c_str()); mPanel->setSelectedTabByName(tmp); -/* - for (std::list<SetupTab*>::const_iterator it = mTabs.begin(); - it != mTabs.end(); ++it) - { - if (*it) - { - SetupTab *tab = *it; - logger->log("check tab: " + tab->getName()); - if (tab->getName() == tmp) - { - mPanel->setSelectedTabByName(name); - return; - } - } - } -*/ +} + +void Setup::setVisible(bool visible) +{ + touchManager.setTempHide(visible); + Window::setVisible(visible); } Setup *setupWindow; diff --git a/src/gui/setup.h b/src/gui/setup.h index ef6521700..51a4e5c26 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -76,6 +76,8 @@ class Setup final : public Window, public gcn::ActionListener void activateTab(const std::string &name); + void setVisible(bool visible) override; + private: std::list<SetupTab*> mTabs; std::list<Window*> mWindowsToReset; diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp index af90c65e3..38f9c3237 100644 --- a/src/touchmanager.cpp +++ b/src/touchmanager.cpp @@ -44,7 +44,9 @@ TouchManager::TouchManager() : mShowButtons(false), mButtonsSize(1), mJoystickSize(1), - mInGame(false) + mShow(false), + mInGame(false), + mTempHideButtons(false) { for (int f = 0; f < actionsSize; f ++) mActions[f] = false; @@ -159,7 +161,7 @@ void TouchManager::draw() it != it_end; ++ it) { const TouchItem *const item = *it; - if (item && item->images && (mInGame || item == mKeyboard)) + if (item && item->images && (mShow || item == mKeyboard)) { mainGraphics->calcWindow(mVertexes, item->x, item->y, item->width, item->height, *item->images); @@ -175,7 +177,7 @@ void TouchManager::draw() it != it_end; ++ it) { const TouchItem *const item = *it; - if (item && item->images && (mInGame || item == mKeyboard)) + if (item && item->images && (mShow || item == mKeyboard)) { mainGraphics->drawImageRect(item->x, item->y, item->width, item->height, *item->images); @@ -193,7 +195,7 @@ bool TouchManager::processEvent(const MouseInput &mouseInput) it != it_end; ++ it) { const TouchItem *const item = *it; - if (!item || (!mInGame && item != mKeyboard)) + if (!item || (!mShow && item != mKeyboard)) continue; const gcn::Rectangle &rect = item->rect; if (rect.isPointInRect(x, y)) @@ -398,5 +400,13 @@ void TouchManager::optionChanged(const std::string &value) void TouchManager::setInGame(bool b) { mInGame = b; + mShow = mInGame && !mTempHideButtons; + mRedraw = true; +} + +void TouchManager::setTempHide(bool b) +{ + mTempHideButtons = b; + mShow = mInGame && !mTempHideButtons; mRedraw = true; } diff --git a/src/touchmanager.h b/src/touchmanager.h index 883080514..cad10f3c6 100644 --- a/src/touchmanager.h +++ b/src/touchmanager.h @@ -137,6 +137,8 @@ class TouchManager final : public ConfigListener void setInGame(bool b); + void setTempHide(bool b); + private: TouchItem *mKeyboard; TouchItem *mPad; @@ -150,7 +152,9 @@ class TouchManager final : public ConfigListener bool mShowButtons; int mButtonsSize; int mJoystickSize; + bool mShow; bool mInGame; + bool mTempHideButtons; }; extern TouchManager touchManager; |