summaryrefslogtreecommitdiff
path: root/src/gui/sdlinput.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-19 23:48:29 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-19 23:48:29 +0300
commit0b7e752bd177c90a05ca752fa31810f9e34c432c (patch)
treedb1809a48faf051af11c94058e8f126c9e9ef1ab /src/gui/sdlinput.cpp
parent23f87c10db7e6b149e9e1f351e1a82516c545df7 (diff)
downloadmanaplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.gz
manaplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.bz2
manaplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.tar.xz
manaplus-0b7e752bd177c90a05ca752fa31810f9e34c432c.zip
Dehardcode keys in gui widgets.
Add new tab with keys settings in input settings tab.
Diffstat (limited to 'src/gui/sdlinput.cpp')
-rw-r--r--src/gui/sdlinput.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index 94519469b..6828158d2 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -127,7 +127,7 @@ void SDLInput::pushInput(const SDL_Event &event)
keyInput.setMetaPressed(event.key.keysym.mod & KMOD_META);
keyInput.setNumericPad(event.key.keysym.sym >= SDLK_KP0
&& event.key.keysym.sym <= SDLK_KP_EQUALS);
- int actionId = inputManager.getActionByKey(event);
+ const int actionId = inputManager.getActionByKey(event);
if (actionId >= 0)
keyInput.setActionId(actionId);
mKeyInputQueue.push(keyInput);
@@ -135,6 +135,7 @@ void SDLInput::pushInput(const SDL_Event &event)
}
case SDL_KEYUP:
+ {
keyInput.setKey(gcn::Key(convertKeyCharacter(event)));
keyInput.setType(gcn::KeyInput::RELEASED);
keyInput.setShiftPressed(event.key.keysym.mod & KMOD_SHIFT);
@@ -143,9 +144,12 @@ void SDLInput::pushInput(const SDL_Event &event)
keyInput.setMetaPressed(event.key.keysym.mod & KMOD_META);
keyInput.setNumericPad(event.key.keysym.sym >= SDLK_KP0
&& event.key.keysym.sym <= SDLK_KP_EQUALS);
-
+ const int actionId = inputManager.getActionByKey(event);
+ if (actionId >= 0)
+ keyInput.setActionId(actionId);
mKeyInputQueue.push(keyInput);
break;
+ }
case SDL_MOUSEBUTTONDOWN:
mMouseDown = true;