• Advertisement
Sign in to follow this  

Key codes in SDL

This topic is 2906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I experimentally saw that the SDL key codes are ascii codes, e.g. 'a' is the same as SDLK_a. But keys on the keyboard have two symbols on them, e.g. = and + are on the same key. But + requires pressing shift. And in SDL the shift is a modifier, and = the ascii code. How exactly does the reasoning behind these ascii codes to identify pressed keys work? Does it use the ascii code of the symbol that is gotten when NOT pressing shift? If so, should a '+' be detected by detecting if the key with ascii code '=' is pressed in combination with shift? But how does this behave on other keyboards than qwerty if the OS or the SDL implementation for that OS doesn't convert from qwerty to e.g. azerty? (see my remark about linux vs windows below) In fact I was trying this with an azerty keyboard instead of a qwerty keyboard myself, and the + key is also behind shift on an azerty, and I was unable to get events of this key when using '+' as key code. And to add more to the confusion, in Linux the "a" matches the "a" on my azerty, while in Windows, even though the unicode key events of SDL work correct for azerty there, for the key syms, "a" and "q" are swapped in Windows with SDL 1.2... Sorry if the post above is confusing, I'm half posting my experimental results and half asking a question how exactly it works...

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement