1-- These are nicely curated inputs from the keyboard. See the
2-- [Keyboard.Raw library](/docs/Signal/KeyboardRaw.elm) for a
3-- lower-level interface that will let you define more complicated behavior.
6import Native.Keyboard as N
10-- A signal of records indicating which arrow keys are pressed.
12-- `{ x = 0, y = 0 }` when pressing no arrows.
13-- `{ x =-1, y = 0 }` when pressing the left arrow.
14-- `{ x = 1, y = 1 }` when pressing the up and right arrows.
15-- `{ x = 0, y =-1 }` when pressing the down, left, and right arrows.
16arrows : Signal { x:Int, y:Int }
17arrows = N.directions 37 39 38 40
19-- Just like the arrows signal, but this uses keys w, a, s, and d,
20-- which are common controls for many computer games.
21wasd : Signal { x:Int, y:Int }
22wasd = N.directions 65 68 87 83
24-- Custom key directions so that you can support different locales.
25-- The plan is to have a locale independent version of this function
26-- that uses the physical location of keys, but I don't know how to do it.
27directions : KeyCode -> KeyCode -> KeyCode -> KeyCode -> Signal { x:Int, y:Int }
29-- Whether an arbitrary key is pressed.
30isDown : KeyCode -> Signal Bool
32-- Whether the shift key is pressed.
36-- Whether the control key is pressed.
40-- Whether the space key is pressed.
44-- Whether the enter key is pressed.
48-- List of keys that are currently down.
49keysDown : Signal [KeyCode]
51-- The latest key that has been pressed.
52lastPressed : Signal Char
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list