-unsigned short Input::CharToKey(const char* which) {
- for(unsigned short i=0;i<SDLK_LAST;i++) {
- if(!strcasecmp(which,SDL_GetKeyName(SDLKey(i))))
- return i;
- }
- if(!strcasecmp(which,"mouse1")){
- return MOUSEBUTTON1;
- }
- if(!strcasecmp(which,"mouse2")){
- return MOUSEBUTTON2;
- }
- return SDLK_LAST;
+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;