From 0b7e752bd177c90a05ca752fa31810f9e34c432c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 19 Apr 2012 23:48:29 +0300 Subject: Dehardcode keys in gui widgets. Add new tab with keys settings in input settings tab. --- src/gui/sdlinput.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gui/sdlinput.cpp') 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; -- cgit v1.2.3-60-g2f50