From 5b789cfb2d76a5b3c7a8e75963f82812004645b1 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Wed, 1 Mar 2017 23:05:09 +0100 Subject: [PATCH] Handle decor shifting with multiple key press Then it's possible to shift with the keyboard like the mouse (NE, NW, SE, SW). --- src/event.cxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/event.cxx b/src/event.cxx index 0945b83..e6778d4 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -5014,17 +5014,21 @@ bool CEvent::TreatEventBase (const SDL_Event &event) } return true; case SDLK_LEFT: - DecorShift (-2, 2); - return true; case SDLK_RIGHT: - DecorShift (2, -2); - return true; case SDLK_UP: - DecorShift (-3, -3); - return true; case SDLK_DOWN: - DecorShift (3, 3); + { + const Uint8 *state = SDL_GetKeyboardState (nullptr); + if (state[SDL_SCANCODE_LEFT]) + DecorShift (-2, 2); + if (state[SDL_SCANCODE_RIGHT]) + DecorShift (2, -2); + if (state[SDL_SCANCODE_UP]) + DecorShift (-3, -3); + if (state[SDL_SCANCODE_DOWN]) + DecorShift (3, 3); return true; + } case SDLK_HOME: pos = m_pDecor->GetHome(); m_pDecor->SetCoin (pos);