< index
< 2. Console emulator
< 2.3 Handling keyboard input

=====================================
2.3.4 Keyboard event structure
=====================================

typedef struct {
	TCOD_keycode_t vk;
	char c;
	unsigned pressed : 1;
	unsigned lalt : 1;
	unsigned lctrl : 1;
	unsigned ralt : 1;
	unsigned rctrl : 1;
	unsigned shift : 1;
} TCOD_key_t;


This structure contains information about a key pressed/released by the user.
FieldDescription
vkAn arbitrary value representing the physical key on the keyboard. Possible values are stored in the TCOD_keycode_t enum. If no key was pressed, the value is TCODK_NONE
cIf the key correspond to a printable character, the character is stored in this field. Else, this field contains 0.
pressed1 if the event is a key pressed, or 0 for a key released.
laltThis field represents the status of the left Alt key : 1 => pressed, 0 => released.
lctrlThis field represents the status of the left Control key : 1 => pressed, 0 => released.
raltThis field represents the status of the right Alt key : 1 => pressed, 0 => released.
rctrlThis field represents the status of the right Control key : 1 => pressed, 0 => released.
shiftThis field represents the status of the shift key : 1 => pressed, 0 => released.

insert a comment