ckeyboardsdl-2scancodes

What is the difference between an SDL physical key code and an SDL virtual key code?


The struct SDL_Keysym has SDL_Scancode and SDL_Keycode members. What is the difference between them? The documentation does not really clear it up for me. I tried both and they seem to do the same thing.


Solution

  • See the SDL documentation. Scancodes represent the physical position of the keys, modeled after a standard QWERTY keyboard, while Keycodes are the character obtained by pressing the key.

    On an AZERTY keyboard, pressing A will emit a 'Q' scancode and an 'a' keycode.