Process only keys between ASCII 32 and 126 as char events

This fixes bug #55 which ensued from special keys processed as char
and key events if SDL 1.2 was used.
This commit is contained in:
Yamagi Burmeister 2015-01-21 17:24:03 +01:00
parent 59ac327aba
commit 403d26d520

View file

@ -401,13 +401,22 @@ IN_Update(void)
#if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_TEXTINPUT:
Char_Event(event.text.text[0]);
if ((event.text.text[0] >= SDLK_SPACE) &&
(event.text.text[0] < SDLK_DELETE))
{
Char_Event(event.text.text[0]);
}
break;
#endif
case SDL_KEYDOWN:
#if !SDL_VERSION_ATLEAST(2, 0, 0)
Char_Event(event.key.keysym.unicode);
if ((event.key.keysym.unicode >= SDLK_SPACE) &&
(event.key.keysym.unicode < SDLK_DELETE))
{
Char_Event(event.key.keysym.unicode);
}
#endif
if ((event.key.keysym.sym >= SDLK_SPACE) &&