From 9224412274e1e1a31a959083bb257a7d6ab2b113 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 19 Aug 2016 20:40:12 -0400 Subject: Add Sly manual. --- manuals/sly/Keyboard.html | 137 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 manuals/sly/Keyboard.html (limited to 'manuals/sly/Keyboard.html') diff --git a/manuals/sly/Keyboard.html b/manuals/sly/Keyboard.html new file mode 100644 index 0000000..b0de8f3 --- /dev/null +++ b/manuals/sly/Keyboard.html @@ -0,0 +1,137 @@ + + + + + +Sly: Keyboard + + + + + + + + + + + + + + + + + + + + +
+

+Next: , Up: Input   [Contents][Index]

+
+
+ +

4.4.1 Keyboard

+ +
+
(use-modules (sly input keyboard))
+
+ +

Keyboard hooks, signals, and procedures. +

+
+
Scheme Variable: key-press-hook
+

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. +

+ +
+
Scheme Variable: key-release-hook
+

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. +

+ +
+
Scheme Signal: key-last-down
+

The last key pressed. +

+ +
+
Scheme Signal: key-last-up
+

The last key released. +

+ +
+
Scheme Procedure: key-down? key
+

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. +

+
+
Scheme Procedure: key-directions up down left right
+

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. +

+ +
+
Scheme Signal: key-arrows
+

A 2D directional vector based on the state of the arrow keys. +

+ +
+
Scheme Signal: key-wasd
+

A 2D directional vector based on the state of the WASD keys. +

+ + + + + + -- cgit v1.2.3