Struct TCOD_key_t

Struct Documentation

struct TCOD_key_t

Libtcod key event data, as a keycode or text character.

Deprecated:

The libtcod keyboard state has several known issues such as missing or broken functionality. In its current state it exists only for backwards compatibility. These issues should be resolved by using SDL directly for keyboard events.

Public Members

TCOD_keycode_t vk

The TCOD_keycode_t enum of the current key.

char c

The printable character of a keycode if vk == TCODK_CHAR, else 0.

Libtcod 1.6 switched form SDL1 to SDL2 which changed the values returned by this attribute.

Before 1.6 this value could be affected by modifiers such as the shift key.

After 1.6 the SDL key symbol is always returned, which will be the same no matter which modifiers are held.

Deprecated:

The nature of this attribute makes it unsuitable for both printable keys and standard key inputs. Use SDL events instead to differentiate between keycodes, symbols, printable characters.

char text[TCOD_KEY_TEXT_SIZE]

The UTF-8 text of a key when vk == TCODK_TEXT.

Otherwise this will always be \0’`.

TCODK_TEXT is always derived from an SDL_TEXTINPUT event.

bool pressed

True if is this key was pressed.

False if it was released.

bool lalt

True if left alt was held during this event.

bool lctrl

True if left control was held during this event.

bool lmeta

True if the left meta key was held during this event.

bool ralt

True if right alt was held during this event.

bool rctrl

True if right control was held during this event.

bool rmeta

True if the right meta key was held during this event.

bool shift

True if shift was held during this event.