Mercurial > sdl-ios-xcode
comparison src/events/SDL_keyboard.c @ 2989:aba5a5cc2e63
Make the SDL keysyms that represent unprintable ASCII values actually have
those values, for more intuitive use and better compatibility with SDL 1.2.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 04 Jan 2009 17:10:04 +0000 |
parents | 99210400e8b9 |
children | 502adab079a4 |
comparison
equal
deleted
inserted
replaced
2988:e7dd24f2f890 | 2989:aba5a5cc2e63 |
---|---|
971 if (key & SDLK_SCANCODE_MASK) { | 971 if (key & SDLK_SCANCODE_MASK) { |
972 return | 972 return |
973 SDL_GetScancodeName((SDL_scancode) (key & ~SDLK_SCANCODE_MASK)); | 973 SDL_GetScancodeName((SDL_scancode) (key & ~SDLK_SCANCODE_MASK)); |
974 } | 974 } |
975 | 975 |
976 /* Unaccented letter keys on latin keyboards are normally | 976 switch (key) { |
977 labeled in upper case (and probably on others like Greek or | 977 case SDLK_RETURN: |
978 Cyrillic too, so if you happen to know for sure, please | 978 return SDL_GetScancodeName(SDL_SCANCODE_RETURN); |
979 adapt this). */ | 979 case SDLK_ESCAPE: |
980 if (key >= 'a' && key <= 'z') { | 980 return SDL_GetScancodeName(SDL_SCANCODE_ESCAPE); |
981 key -= 32; | 981 case SDLK_BACKSPACE: |
982 } | 982 return SDL_GetScancodeName(SDL_SCANCODE_BACKSPACE); |
983 | 983 case SDLK_TAB: |
984 end = SDL_UCS4ToUTF8((Uint32) key, name); | 984 return SDL_GetScancodeName(SDL_SCANCODE_TAB); |
985 *end = '\0'; | 985 case SDLK_SPACE: |
986 return name; | 986 return SDL_GetScancodeName(SDL_SCANCODE_SPACE); |
987 case SDLK_DELETE: | |
988 return SDL_GetScancodeName(SDL_SCANCODE_DELETE); | |
989 default: | |
990 /* Unaccented letter keys on latin keyboards are normally | |
991 labeled in upper case (and probably on others like Greek or | |
992 Cyrillic too, so if you happen to know for sure, please | |
993 adapt this). */ | |
994 if (key >= 'a' && key <= 'z') { | |
995 key -= 32; | |
996 } | |
997 | |
998 end = SDL_UCS4ToUTF8((Uint32) key, name); | |
999 *end = '\0'; | |
1000 return name; | |
1001 } | |
987 } | 1002 } |
988 | 1003 |
989 /* vi: set ts=4 sw=4 expandtab: */ | 1004 /* vi: set ts=4 sw=4 expandtab: */ |