DragonFly On-Line Manual Pages
key(3) Allegro manual key(3)
key - Array of flags indicating key state. Allegro game programming
extern volatile char key[KEY_MAX];
Array of flags indicating the state of each key, ordered by scancode.
Wherever possible these values will be updated asynchronously, but if
keyboard_needs_poll() returns TRUE, you must manually call
poll_keyboard() to update them with the current input state. The
scancodes are defined in allegro/keyboard.h as a series of KEY_*
constants (and are also listed below). For example, you could write:
printf("Space is pressed\n");
Note that the array is supposed to represent which keys are physically
held down and which keys are not, so it is semantically read-only.
These are the keyboard scancodes:
KEY_A ... KEY_Z,
KEY_0 ... KEY_9,
KEY_0_PAD ... KEY_9_PAD,
KEY_F1 ... KEY_F12,
KEY_ESC, KEY_TILDE, KEY_MINUS, KEY_EQUALS,
KEY_BACKSPACE, KEY_TAB, KEY_OPENBRACE, KEY_CLOSEBRACE,
KEY_ENTER, KEY_COLON, KEY_QUOTE, KEY_BACKSLASH,
KEY_BACKSLASH2, KEY_COMMA, KEY_STOP, KEY_SLASH,
KEY_INSERT, KEY_DEL, KEY_HOME, KEY_END, KEY_PGUP,
KEY_PGDN, KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN,
KEY_SLASH_PAD, KEY_ASTERISK, KEY_MINUS_PAD,
KEY_PLUS_PAD, KEY_DEL_PAD, KEY_ENTER_PAD,
KEY_ABNT_C1, KEY_YEN, KEY_KANA, KEY_CONVERT, KEY_NOCONVERT,
KEY_AT, KEY_CIRCUMFLEX, KEY_COLON2, KEY_KANJI,
KEY_LWIN, KEY_RWIN, KEY_MENU,
KEY_SCRLOCK, KEY_NUMLOCK, KEY_CAPSLOCK
KEY_EQUALS_PAD, KEY_BACKQUOTE, KEY_SEMICOLON, KEY_COMMAND
Finally, you may notice an `odd' behaviour of the KEY_PAUSE key. This
key only generates an interrupt when it is pressed, not when it is
released. For this reason, Allegro pretends the pause key is a `state'
key, which is the only way to make it usable.
install_keyboard(3), poll_keyboard(3), key_shifts(3)
Allegro version 4.4.2 key(3)
key_defined - check if a keycode is defined
int key_defined(const char *definition);
This is an extension to the curses library. It permits an application
to determine if a string is currently bound to any keycode.
If the string is bound to a keycode, its value (greater than zero) is
returned. If no keycode is bound, zero is returned. If the string
conflicts with longer strings which are bound to keys, -1 is returned.
These routines are specific to ncurses. They were not supported on
Version 7, BSD or System V implementations. It is recommended that any
code depending on them be conditioned using NCURSES_VERSION.