When in raw keyboard mode this routine returns a pointer
buffer
to a static buffer. If the value in
buffer [ scancode ]
is
KEY_PRESSED or KEY_NOTPRESSED
the key with that
scancode
is pressed or not. Actually
KEY_PRESSED is 1 and KEY_NOTPRESSED is 0,
s.t. you can use constructs like:
if(buffer[SCANCODE_ENTER]) {
/* do something */
}
This is more efficient than calling
keyboard_keypressed (3)
if you want to check for many different keys.
Please note that keyboard events will only be processed when you occasionally call
keyboard_update (3) or
keyboard_waitforupdate (3).
keyboard_translatekeys (3)
allows certain remap operations which make certain keys (digits, enter) which might have
several physical keys show up under the same scancodes.
Here are the supported scancodes. The names of the
#defines
originate from the US keyboard layout, for other countries, they'll refer to the key
in the same physical location, but the keycap will have a different inscription. For
the list below, add
SCANCODE_
in front of the names to get the right name for your C source. That means, if it lists
BACKSLASH
below, you shall use
SCANCODE_BACKSLASH
as symbol in your program. In addition to the names below we also have
SCANCODE_0 - SCANCODE_9 ,
SCANCODE_KEYPAD0 - SCANCODE_KEYPAD9 ,
SCANCODE_A - SCANCODE_Z , and
SCANCODE_F1 - SCANCODE_F12 .
The other key names are
ESCAPE ,
MINUS ,
EQUAL ,
BACKSPACE ,
TAB ,
BRACKET_LEFT ,
BRACKET_RIGHT ,
ENTER ,
LEFTCONTROL ,
SEMICOLON ,
APOSTROPHE ,
GRAVE ,
LEFTSHIFT ,
BACKSLASH ,
COMMA ,
PERIOD ,
SLASH ,
RIGHTSHIFT ,
KEYPADMULTIPLY ,
LEFTALT ,
SPACE ,
CAPSLOCK ,
NUMLOCK ,
SCROLLLOCK ,
CURSORUPLEFT ,
CURSORUP ,
CURSORUPRIGHT ,
KEYPADMINUS ,
CURSORLEFT ,
CURSORRIGHT ,
KEYPADPLUS ,
CURSORDOWNLEFT ,
CURSORDOWN ,
CURSORDOWNRIGHT ,
KEYPADPERIOD ,
LESS ,
KEYPADENTER ,
RIGHTCONTROL ,
CONTROL ,
KEYPADDIVIDE ,
PRINTSCREEN ,
RIGHTALT ,
BREAK ,
BREAK_ALTERNATIVE ,
HOME ,
CURSORBLOCKUP ,
PAGEUP ,
CURSORBLOCKLEFT ,
CURSORBLOCKRIGHT ,
END ,
CURSORBLOCKDOWN ,
PAGEDOWN ,
INSERT , and
REMOVE .