mirror of
https://github.com/swarm-game/swarm.git
synced 2024-10-27 01:49:15 +03:00
599225f4d6
Ability to code your own input handler routines. Closes #102 . Fixes #1210 . * Adds a new type `key` to represent keypresses * Adds a primitive function `key : text -> key` which can handle usual letters, numbers, etc. as well as special keys like `"Down"` etc, as well as modifier key prefixes like `key "A-C-Del"`. `swarm generate keys` generates a list of all recognized special key names. * New command `installKeyHandler : text -> (key -> cmd unit) -> cmd unit` which sets the "current key handler". The `text` value is a hint line to display in the secondary key hints menu while the handler is running. The global shortcut `M-k` toggles the currently installed handler. * Add a `keyboard` device to provide these commands, as well as a `key` entity (the recipe for a `keyboard` is 16 `key`s + 1 `board`). * Add a few examples in the `examples` folder. * Add an installed `keyboard` to the `building-bridges` challenge. |
||
---|---|---|
.. | ||
BFS-clear.sw | ||
cat.sw | ||
dfs.sw | ||
fact.sw | ||
list.sw | ||
multi-key-handler.sw | ||
pilotmode.sw | ||
wander.sw |