SDL_KeyboardEvent(3)

SDL_KeyboardEvent3

Keyboard event structure

Structure definition

typedef struct{
  Uint8 type;
  Uint8 state;
  SDL_keysym keysym;
} SDL_KeyboardEvent;

Structure data

type

SDL_KEYDOWN or SDL_KEYUP

state

SDL_PRESSED or SDL_RELEASED

keysym

Contains key press information

Overview

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 occurs when a key is released (type=SDK_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 structure.

Note:

Repeating SDL_KEYDOWN events will occur if key repeat is enabled (see SDL_EnableKeyRepeat).

Releases

11 releases since Debian 3.0 (Woody); the text changed 1 time.

  1. 3.0–5.0
  2. 6.0–12

From libsdl1.2-dev 1.2.15+dfsg2-8 in Debian 12 (Bookworm). Parsed by carta from the page's man source.