Wiki Page Content

Differences between revisions 17 and 18
Revision 17 as of 2011-11-14 16:37:56
Size: 2656
Editor: SheenaSmith
Comment: add search exclusions for SG pages
Revision 18 as of 2012-01-04 18:35:38
Size: 2674
Editor: SheenaSmith
Comment: cached searchs
Deletions are marked like this. Additions are marked like this.
Line 26: Line 26:
<<FullSearch(category:CategoryEnum CategoryKeyboard -SGEnumerations)>> <<FullSearchCached(category:CategoryEnum CategoryKeyboard -SGEnumerations)>>
Line 29: Line 29:
<<FullSearch(category:CategoryStruct CategoryKeyboard -SGStructures)>> <<FullSearchCached(category:CategoryStruct CategoryKeyboard -SGStructures)>>
Line 32: Line 32:
<<FullSearch(category:CategoryKeyboard -CategoryEnum -CategoryStruct -SGFunctions)>> <<FullSearchCached(category:CategoryKeyboard -CategoryEnum -CategoryStruct -SGFunctions)>>

Keyboard Support

Include File(s): SDL_keyboard.h, SDL_keycode.h, SDL_scancode.h

Introduction

This category contains functions for handling keyboard inputs.

SDL uses two different types of values to represent keys on the keyboard - scancode and keycode.

SDL_Scancode values are used to represent the physical location of a keyboard key on the keyboard. Values of this type are used to represent keyboard keys in the key.keysym.scancode field of the SDL_Event structure, among other places. The values in the SDL_Scancode enumeration are based on the USB usage page standard (http://www.usb.org/developers/docs/). Scancode constants use the symbol name prefixed with SDL_SCANCODE_ (eg: SDL_SCANCODE_SPACE).

SDL_Keycode values are mapped to the current layout of the keyboard and correlate to an SDL_Scancode. Values of this type are used to represent key symbols in the key.keysym.sym field of the SDL_Event structure, among other places. The values in the SDL_Keycode enumeration are based on Unicode values representing the unmodified character that would be generated by pressing the key, or the scancode value with the high bit set (bitwise ANDed with 0x8000000) for those keys that do not generate characters. Keycode constants use the symbol name (lowercased for letters) prefixed with SDLK_ (eg: SDLK_SPACE).

The main difference between these two values comes into play in situations where the operating system is mapping the physical keyboard keys to different virtual letters. For instance, when a standard QWERTY keyboard is mapped to a German QWERTZ layout, the "Y" key will generate events with a scancode of SDL_SCANCODE_Y, but a keycode of SDLK_z. Which one to use is left to the application: scancodes are suited in situations where controls are layout-dependent (eg. the "WASD" keys as left-handed arrow keys), whereas keycodes are better suited to situations where controls are character-dependent (eg. the "I" key for Inventory).

Enumerations

Structures

Functions


CategoryCategory

None: CategoryKeyboard (last edited 2018-07-26 23:26:54 by DanielG)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit