From: Guus Sliepen Date: Sat, 8 Aug 2015 20:13:24 +0000 (+0200) Subject: Fix display of key names in the keyboard configuration screen. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=65f6b1dc35fecffa944324af17869f1955d09bde;p=quix0rs-blobwars.git Fix display of key names in the keyboard configuration screen. --- diff --git a/src/CKeyboard.cpp b/src/CKeyboard.cpp index 89e6e0e..955e503 100644 --- a/src/CKeyboard.cpp +++ b/src/CKeyboard.cpp @@ -39,16 +39,18 @@ void Keyboard::setDefaultKeys() control[CONTROL::MAP] = SDL_SCANCODE_TAB; } -const char *Keyboard::translateKey(int key) +const char *Keyboard::translateKey(int scancode) { static char keyName[50]; keyName[0] = 0; keyName[0] = '\0'; - if (key <= 0) + if (scancode <= 0) { return "..."; } + + SDL_Keycode key = SDL_GetKeyFromScancode((SDL_Scancode)scancode); strlcpy(keyName, _(SDL_GetKeyName(key)), sizeof keyName);