\scheme{(require (planet "keyboard.ss" ("kazzmir" "allegro.plt")))}

Function List

\makelink{keypressed?}
\makelink{key-modifiers}
\makelink{readkey}
\makelink{simulate-keypress}
\makelink{clear-keyboard}
\makelink{current-keys}

\mark{keypressed?}
\function{(keypressed? key)}{boolean}

Returns #t if \var{key} is pressed, else #f. Possible values for \var{key} are

\scheme{'A}\newline
\scheme{'B}\newline
\scheme{'C}\newline
\scheme{'D}\newline
\scheme{'E}\newline
\scheme{'F}\newline
\scheme{'G}\newline
\scheme{'H}\newline
\scheme{'I}\newline
\scheme{'J}\newline
\scheme{'K}\newline
\scheme{'L}\newline
\scheme{'M}\newline
\scheme{'N}\newline
\scheme{'O}\newline
\scheme{'P}\newline
\scheme{'Q}\newline
\scheme{'R}\newline
\scheme{'S}\newline
\scheme{'T}\newline
\scheme{'U}\newline
\scheme{'V}\newline
\scheme{'W}\newline
\scheme{'X}\newline
\scheme{'Y}\newline
\scheme{'Z}\newline
\scheme{'NUM-0}\newline
\scheme{'NUM-1}\newline
\scheme{'NUM-2}\newline
\scheme{'NUM-3}\newline
\scheme{'NUM-4}\newline
\scheme{'NUM-5}\newline
\scheme{'NUM-6}\newline
\scheme{'NUM-7}\newline
\scheme{'NUM-8}\newline
\scheme{'NUM-9}\newline
\scheme{'PAD-0}\newline
\scheme{'PAD-1}\newline
\scheme{'PAD-2}\newline
\scheme{'PAD-3}\newline
\scheme{'PAD-4}\newline
\scheme{'PAD-5}\newline
\scheme{'PAD-6}\newline
\scheme{'PAD-7}\newline
\scheme{'PAD-8}\newline
\scheme{'PAD-9}\newline
\scheme{'F1}\newline
\scheme{'F2}\newline
\scheme{'F3}\newline
\scheme{'F4}\newline
\scheme{'F5}\newline
\scheme{'F6}\newline
\scheme{'F7}\newline
\scheme{'F8}\newline
\scheme{'F9}\newline
\scheme{'F10}\newline
\scheme{'F11}\newline
\scheme{'F12}\newline
\scheme{'ESC}\newline
\scheme{'TILDE}\newline
\scheme{'MINUS}\newline
\scheme{'EQUALS}\newline
\scheme{'BACKSPACE}\newline
\scheme{'TAB}\newline
\scheme{'OPENBRACE}\newline
\scheme{'CLOSEBRACE}\newline
\scheme{'ENTER}\newline
\scheme{'COLON}\newline
\scheme{'QUOTE}\newline
\scheme{'BACKSLASH}\newline
\scheme{'BACKSLASH2}\newline
\scheme{'COMMA}\newline
\scheme{'STOP}\newline
\scheme{'SLASH}\newline
\scheme{'SPACE}\newline
\scheme{'INSERT}\newline
\scheme{'DEL}\newline
\scheme{'HOME}\newline
\scheme{'END}\newline
\scheme{'PGUP}\newline
\scheme{'PGDN}\newline
\scheme{'LEFT}\newline
\scheme{'RIGHT}\newline
\scheme{'UP}\newline
\scheme{'DOWN}\newline
\scheme{'SLASH_PAD}\newline
\scheme{'ASTERISK}\newline
\scheme{'MINUS_PAD}\newline
\scheme{'PLUS_PAD}\newline
\scheme{'DEL_PAD}\newline
\scheme{'ENTER_PAD}\newline
\scheme{'PRTSCR}\newline
\scheme{'PAUSE}\newline
\scheme{'ABNT_C1}\newline
\scheme{'YEN}\newline
\scheme{'KANA}\newline
\scheme{'CONVERT}\newline
\scheme{'NOCONVERT}\newline
\scheme{'AT}\newline
\scheme{'CIRCUMFLEX}\newline
\scheme{'COLON2}\newline
\scheme{'KANJI}\newline
\scheme{'EQUALS_PAD}\newline
\scheme{'BACKQUOTE}\newline
\scheme{'SEMICOLON}\newline
\scheme{'COMMAND}\newline
\scheme{'UNKNOWN1}\newline
\scheme{'UNKNOWN2}\newline
\scheme{'UNKNOWN3}\newline
\scheme{'UNKNOWN4}\newline
\scheme{'UNKNOWN5}\newline
\scheme{'UNKNOWN6}\newline
\scheme{'UNKNOWN7}\newline
\scheme{'UNKNOWN8}\newline
\scheme{'MODIFIERS}\newline
\scheme{'LSHIFT}\newline
\scheme{'RSHIFT}\newline
\scheme{'LCONTROL}\newline
\scheme{'RCONTROL}\newline
\scheme{'ALT}\newline
\scheme{'ALTGR}\newline
\scheme{'LWIN}\newline
\scheme{'RWIN}\newline
\scheme{'MENU}\newline
\scheme{'SCRLOCK}\newline
\scheme{'NUMLOCK}\newline
\scheme{'CAPSLOCK}\newline

\mark{key-modifiers}
\function{(key-modifiers)}{list-of symbol}

Returns a list of key modifiers currently pressed. Possible values are

\scheme{'SHIFT}\newline
\scheme{'CTRL}\newline
\scheme{'ALT}\newline
\scheme{'LWIN}\newline
\scheme{'RWIN}\newline
\scheme{'MENU}\newline
\scheme{'COMMAND}\newline
\scheme{'SCROLOCK}\newline
\scheme{'NUMLOCK}\newline
\scheme{'CAPSLOCK}\newline
\scheme{'INALTSEQ}\newline
\scheme{'ACCENT1}\newline
\scheme{'ACCENT2}\newline
\scheme{'ACCENT3}\newline
\scheme{'ACCENT4}\newline

\mark{current-keys}
\function{(current-keys)}{list-of symbol}

Returns a list containing the current keys pressed and the current key modifiers pressed. In short it is about equivalent to the psuedo-code \scheme{(append (key-modifiers) (map keypressed? all-keys))}.

\mark{readkey}
\function{(readkey)}{symbol}

Returns the name of a key that was pressed. This function blocks until a key is pressed. The key names are the same for \link{keypressed?}.

\mark{simulate-keypress}
\function{(simulate-keypress key)}{void}

Puts \var{key} into the key buffer so that the next call to \link{readkey} will return that key.

\mark{clear-keyboard}
\function{(clear-keyboard)}{void}

Clears the keyboard buffer so that \link{readkey} will block until a key is pressed.


