(use-modules (sly input keyboard))
Keyboard hooks, signals, and procedures.
This hook is run whenever a key is pressed down. Procedures added to
this hook should accept two arguments: key
, a symbol, and
char
, a unicode character.
This hook is run whenever a key is released. Procedures added to this
hook should accept two arguments: key
, a symbol, and
char
, a unicode character.
The last key pressed.
The last key released.
Create a signal for the state of key
. The signal value is
#t
when key
is pressed and #f
otherwise.
A lot of games use directional keys to control the player. The below procedure and signals make this style of movement easy to use.
Create a signal whose value is a 2D unit vector that can be used for
8-directional movement. The vector is determined by the state of the
directional keys: up
, down
, left
, right
.
A 2D directional vector based on the state of the arrow keys.
A 2D directional vector based on the state of the WASD keys.