[SDL] case sensitive key down?

David White davidnwhite at optusnet.com.au
Fri May 21 21:04:15 PDT 2004


> Forget about scan codes, qualifier keys and stuff. You'll just get a
> headache and a non-portable and/or missbehaved application.
>
> In your initialization:
>
> SDL_EnableUNICODE(1);
>
> and then when you get a keyboard event: (From 'man SDL_keysym')
>
> if(!(event.key.keysym.unicode & 0xff80))
> ascii = event.key.keysym.unicode;
> else
> <deal with international characters>;
>
> This method actually *works*, even with weird keyboard layouts like my
> custom swedish Dvorak variant. :-)

Except that it seems that, at least on Win32, there is a problem that SDL
will take the shift-state at the time that the key event is processed,
rather than what it was when the key was pressed.

David White
Lead Developer
Battle for Wesnoth (http://www.wesnoth.org)





More information about the SDL mailing list