Keyboard

(require (planet "keyboard.ss" ("kazzmir" "allegro.plt")))

Function List

keypressed?
key-modifiers
readkey
simulate-keypress
clear-keyboard
current-keys


top

procedure: (keypressed? key) :: boolean

Returns #t if key is pressed, else #f. Possible values for key are

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


top

procedure: (key-modifiers) :: list-of symbol

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

'SHIFT
'CTRL
'ALT
'LWIN
'RWIN
'MENU
'COMMAND
'SCROLOCK
'NUMLOCK
'CAPSLOCK
'INALTSEQ
'ACCENT1
'ACCENT2
'ACCENT3
'ACCENT4


top

procedure: (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 (append (key-modifiers) (map keypressed? all-keys)).


top

procedure: (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 keypressed?.


top

procedure: (simulate-keypress key) :: void

Puts key into the key buffer so that the next call to readkey will return that key.


top

procedure: (clear-keyboard) :: void

Clears the keyboard buffer so that readkey will block until a key is pressed.