summaryrefslogtreecommitdiff
path: root/src/inputmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-08 21:20:49 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-08 21:20:49 +0300
commit6b18411ee5855acdbce2e0ab5dd508cb07b04706 (patch)
tree7eee355a1dfa9f2262d45a34954e611e5bd17a9a /src/inputmanager.cpp
parentbb258f09a0b50f6382be2ff36637191a8b103c3f (diff)
downloadManaVerse-6b18411ee5855acdbce2e0ab5dd508cb07b04706.tar.gz
ManaVerse-6b18411ee5855acdbce2e0ab5dd508cb07b04706.tar.bz2
ManaVerse-6b18411ee5855acdbce2e0ab5dd508cb07b04706.tar.xz
ManaVerse-6b18411ee5855acdbce2e0ab5dd508cb07b04706.zip
Allow assign keys before connecting to game.
Diffstat (limited to 'src/inputmanager.cpp')
-rw-r--r--src/inputmanager.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp
index cc45a79cf..22af8438c 100644
--- a/src/inputmanager.cpp
+++ b/src/inputmanager.cpp
@@ -361,18 +361,25 @@ void InputManager::unassignKey()
keyboard.update();
}
+bool InputManager::handleAssignKey(const SDL_Event &event)
+{
+ if (setupWindow && setupWindow->isVisible() &&
+ getNewKeyIndex() > Input::KEY_NO_VALUE)
+ {
+ setNewKey(event);
+ callbackNewKey();
+ setNewKeyIndex(Input::KEY_NO_VALUE);
+ return true;
+ }
+ return false;
+}
+
bool InputManager::handleEvent(const SDL_Event &event)
{
if (event.type == SDL_KEYDOWN)
{
- if (setupWindow && setupWindow->isVisible() &&
- getNewKeyIndex() > Input::KEY_NO_VALUE)
- {
- setNewKey(event);
- callbackNewKey();
- setNewKeyIndex(Input::KEY_NO_VALUE);
+ if (handleAssignKey(event))
return true;
- }
// send straight to gui for certain windows
if (quitDialog || TextDialog::isActive() ||