SDL Wiki
(This is the legacy documentation for stable SDL2, the current stable version; SDL3 is the current development version.)

Draft

THIS PAGE IS A WORK IN PROGRESS ... Please make edits to this page to improve it!

SDL_Keycode

The SDL virtual key representation.

Header File

Defined in [SDL_keycode.h](https://github.com/libsdl-org/SDL/blob/SDL2/include/SDL_keycode.h), but apps should _only_ `#include "SDL.h"`!

Syntax

typedef Sint32 SDL_Keycode;

Remarks

Values of this type are used to represent keyboard keys using the current layout of the keyboard. These values include Unicode values representing the unmodified character that would be generated by pressing the key, or an SDLK_* constant for those keys that do not generate characters.

A special exception is the number keys at the top of the keyboard which map to SDLK_0...SDLK_9 on AZERTY layouts.

Code Examples

  //checks if a key is being remapped and prints what the remapping is
  if(event->key.keysym.scancode != SDL_GetScancodeFromKey(event->key.keysym.sym))
    printf("Physical %s key acting as %s key",
      SDL_GetScancodeName(event->key.keysym.scancode),
      SDL_GetKeyName(event->key.keysym.sym));
SDL_Scancode

CategoryAPI, CategoryAPIDatatype, CategoryEnum, CategoryKeyboard, CategoryDraft


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.