|
Size: 866
Comment: spam
|
Size: 2207
Comment: add content from old wiki
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 23: | Line 23: |
| ''You can add useful comments here'' | *The following is taken from the old wiki, which had fewer data fields* [[SDL_KeyboardEvent]]() is a member of the [[SDL_Event]] union and is used when an event of type SDL_KEYDOWN or SDL_KEYUP is reported. The '''type''' and '''state''' actually report the same information, they just use different values to do it. A keyboard event generally occurs when a key is released (type=SDL_KEYUP or state=SDL_RELEASED) and when a key is pressed (type=SDL_KEYDOWN or state=SDL_PRESSED). The information on what key was pressed or released is in the '''keysym''' member. The SDLK_CAPSLOCK and SDLK_NUMLOCK keys are special cases and report an SDL_KEYDOWN when first pressed, then an SDL_RELEASED when released and pressed again. For these keys KEYUP and KEYDOWN events are therefore analogous to the state of the caps lock and num lock LEDs rather than the keys themselves. These special cases are required for compatibility with Sun workstations, but may be modified for most users through adjustments around lines 403 and 449 of src/events/SDL_keyboard.c. Note: Repeating SDL_KEYDOWN events will occur if key repeat is enabled (see SDL_!EnableKeyRepeat). <<Color2(green,SDL_!EnableKeyRepeat does not currently have a page and may not exist in SDL 1.3.)>> |
| Line 32: | Line 40: |
| <<Color2(green,Listed in the old wiki but appear to be absent from 1.3: SDL_!EnableKeyRepeat, SDL_EnableUNICODE)>> |
DRAFT |
SDL_KeyboardEvent
A structure that contains keyboard button event structure information (event.key.*).
Contents
Data Fields
Uint8 |
type |
SDL_KEYDOWN or SDL_KEYUP |
Uint32 |
windowID |
the window with keyboard focus, if any |
Uint8 |
which |
the keyboard device index |
Uint8 |
state |
SDL_PRESSED or SDL_RELEASED |
keysym |
the key that was pressed or released |
Code Examples
You can add your code example here
Remarks
*The following is taken from the old wiki, which had fewer data fields*
SDL_KeyboardEvent() is a member of the SDL_Event union and is used when an event of type SDL_KEYDOWN or SDL_KEYUP is reported.
The type and state actually report the same information, they just use different values to do it. A keyboard event generally occurs when a key is released (type=SDL_KEYUP or state=SDL_RELEASED) and when a key is pressed (type=SDL_KEYDOWN or state=SDL_PRESSED). The information on what key was pressed or released is in the keysym member.
The SDLK_CAPSLOCK and SDLK_NUMLOCK keys are special cases and report an SDL_KEYDOWN when first pressed, then an SDL_RELEASED when released and pressed again. For these keys KEYUP and KEYDOWN events are therefore analogous to the state of the caps lock and num lock LEDs rather than the keys themselves. These special cases are required for compatibility with Sun workstations, but may be modified for most users through adjustments around lines 403 and 449 of src/events/SDL_keyboard.c.
Note: Repeating SDL_KEYDOWN events will occur if key repeat is enabled (see SDL_EnableKeyRepeat). green
Related Enumerations
Related Structures
SDL_keysym???
Related Functions
green
