X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FUtils%2FInput.cpp;h=04efb4b4a1da68a6716b062ff9486da53d971709;hb=31191d0c0118f6abfccd7bf3ecc13bbfef3fa335;hp=30667c786e37e28ce4d32dc082892b113d899d19;hpb=21b3a070442ca66eb5063457942dbacd3c3588a9;p=lugaru.git diff --git a/Source/Utils/Input.cpp b/Source/Utils/Input.cpp index 30667c7..04efb4b 100644 --- a/Source/Utils/Input.cpp +++ b/Source/Utils/Input.cpp @@ -56,7 +56,7 @@ bool Input::isKeyPressed(int k) const char* Input::keyToChar(unsigned short i) { if (i < SDL_NUM_SCANCODES) - return SDL_GetScancodeName(SDL_Scancode(i)); + return SDL_GetKeyName(SDL_GetKeyFromScancode(SDL_Scancode(i))); else if (i == MOUSEBUTTON1) return "mouse1"; else if (i == MOUSEBUTTON2) @@ -67,24 +67,6 @@ const char* Input::keyToChar(unsigned short i) return "unknown"; } -unsigned short Input::CharToKey(const char* which) -{ - for (unsigned short i = 0; i < SDL_NUM_SCANCODES; i++) { - if (!strcasecmp(which, SDL_GetScancodeName(SDL_Scancode(i)))) - return i; - } - if (!strcasecmp(which, "mouse1")) { - return MOUSEBUTTON1; - } - if (!strcasecmp(which, "mouse2")) { - return MOUSEBUTTON2; - } - if (!strcasecmp(which, "mouse3")) { - return MOUSEBUTTON3; - } - return SDL_NUM_SCANCODES; -} - bool Input::MouseClicked() { return isKeyPressed(SDL_NUM_SCANCODES + SDL_BUTTON_LEFT);