Hi there,
This is sort of a newbie question here, though I have searched the forum and only found pretty old messages related to the subject.
I understand the keydown event returns 2 different approaches to detecting the key that was pressed, keycode and scancode. Reading the manuals online, I understand that the idea is that scancode returns some physical code for the key pressed, while keycode tries to provide a code that represents a symbol that is mapped to the key pressed based on current keyboard layout in use.
Which is great.
Furthermore, we have the modifier field which lets us identify if a modifier was simultaneously pressed, like shift, control, alt, etc.
However, and here is my question:
I understand that scancode will provide a single code per key, and modifiers let´s us check that user is trying to get alternater results from the key (shift for uppercase, etc). So, this is great if my application needs to take care of the keyboard mappings by itself, and the code must be ready to process different mappings for different keyboard layouts.
I am failing to graps however the benefit of keycode use. It correctly returns the mapped symbol code only for the non.modified symbols. So, if I press âaâ in my keyboard, I get a code for âaâ. But if I press SHIFT-A, I still get a code for âaâ and am supposed to check the modifier to understand an uppercase symbol is required. Meaning we don´t get the benefit of resolving the symbol using system mappings and now need to think/configure in our application how does modifiers work on different layouts.
Most keyboard have very different symbol mappings for the number-shift combinations, some use alt-gr as well, and not being able to use a pre-defined âkey to symbol mappingâ seems a great shortcoming.
Is this really how this works or am I missing something ? Is there a way for SDL to resolve the keyboard symbol mapping without needing to rely on manual configuration on the programming side when using keycode or other functions?