summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-28 21:14:10 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-28 21:14:13 +0100
commitb2bf666510ae7e4d4fa71f7ab2de4728a050ef3c (patch)
tree4bb30682f9afc8919e50c6ec660719ce720ef116
parent264be2108c51837fa92085f6c839e66aebbcfc9e (diff)
downloadmana-b2bf666510ae7e4d4fa71f7ab2de4728a050ef3c.tar.gz
mana-b2bf666510ae7e4d4fa71f7ab2de4728a050ef3c.tar.bz2
mana-b2bf666510ae7e4d4fa71f7ab2de4728a050ef3c.tar.xz
mana-b2bf666510ae7e4d4fa71f7ab2de4728a050ef3c.zip
Fixed crash due to SDL2 porting issue
SDL_GetKeyState used to return an array that is indexed by SDLKey, but its equivalant, SDL_GetKeyboardState, returns an array that is supposed to be indexed using SDL_Scancode.
-rw-r--r--src/keyboardconfig.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index dfd461db..3632acf9 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -228,7 +228,8 @@ bool KeyboardConfig::isKeyActive(int index) const
{
if (!mActiveKeys)
return false;
- return mActiveKeys[mKey[index].value];
+ int scanCode = SDL_GetScancodeFromKey(mKey[index].value);
+ return mActiveKeys[scanCode];
}
void KeyboardConfig::refreshActiveKeys()