[SDL] Displaying keys pushed on european keyboards?

pulkomandy at pulkomandy.ath.cx pulkomandy at pulkomandy.ath.cx
Wed Jul 20 10:58:01 PDT 2011


On 2011-07-20 at 19:43:14 [+0200], VernJensen <vern at actionsoft.com> wrote:
> The "Change Keys" dialog in my game displays the keys a user chooses for 
> walking and jumping. However, on international keyboards, if they push keys 
> like ö and ä, it will display the U.S. keyboard symbols for that key 
> instead of the european one. I'm wondering how to detect, under SDL, that a 
> European keyboard was used, and determine which symbol (using my own 
> pre-rendered bitmap font) to display for it?

Use SDL_keysym.unicode to get the proper value.
There is a bit more involved if you want to properly handle keys such as 
control, alt, or space. Here is the functions we use for handling keyboard :

http://code.google.com/p/grafx2/source/browse/trunk/src/keyboard.c

And some documentation :
http://code.google.com/p/grafx2/source/browse/trunk/src/keyboard.h

-- 
Adrien.



More information about the SDL mailing list