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

Mampoempan picture Mampoempan · Aug 11, 2015 · Viewed 11k times · Source

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.

Answer

Quentin picture Quentin · Aug 11, 2015

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.