From f4cb7985f2486f948204006c95200839ab8c960e Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Fri, 22 May 2009 18:28:01 +0000 Subject: [PATCH] More manual ANSI conversions for when Unicode is off git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@813 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- keyboard.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/keyboard.c b/keyboard.c index b1289696..d3b76ddc 100644 --- a/keyboard.c +++ b/keyboard.c @@ -546,7 +546,21 @@ word Keysym_to_ANSI(SDL_keysym keysym) // Converty lowercase to uppercase if SHIFT is on. if (keysym.sym >= 'a' && keysym.sym <= 'z' && (SDL_GetModState() & (KMOD_SHIFT|KMOD_CAPS))) return ('A' - 'a') + keysym.sym; - return keysym.sym; + // Convert keypad to numbers + if (keysym.sym >= SDLK_KP0 && keysym.sym <= SDLK_KP9) + return ('0' - SDLK_KP0) + keysym.sym; + // More conversions + switch (keysym.sym) + { + case SDLK_KP_PERIOD: return '.'; + case SDLK_KP_DIVIDE: return '/'; + case SDLK_KP_MINUS: return '-'; + case SDLK_KP_PLUS: return '+'; + case SDLK_KP_ENTER: return '\r'; + case SDLK_KP_EQUALS: return '='; + default: + return keysym.sym; + } } #endif //