2{-| Library for working with keyboard input.
8@docs arrows, wasd, directions
11@docs shift, enter, space, ctrl
14@docs isDown, keysDown, lastPressed
21{-| Type alias to make it clearer what integers are supposed to represent
22in this library. Use `Char.toCode` and `Char.fromCode` to convert key codes
23to characters. Use the uppercase character with `toCode`.
27{-| Custom key directions to support different locales. The order is up, down,
30directions : KeyCode -> KeyCode -> KeyCode -> KeyCode -> Signal { x:Int, y:Int }
31directions = Native.Keyboard.directions
33{-| A signal of records indicating which arrow keys are pressed.
35`{ x = 0, y = 0 }` when pressing no arrows.<br>
36`{ x =-1, y = 0 }` when pressing the left arrow.<br>
37`{ x = 1, y = 1 }` when pressing the up and right arrows.<br>
38`{ x = 0, y =-1 }` when pressing the down, left, and right arrows.
40arrows : Signal { x:Int, y:Int }
41arrows = directions 38 40 37 39
43{-| Just like the arrows signal, but this uses keys w, a, s, and d,
44which are common controls for many computer games.
46wasd : Signal { x:Int, y:Int }
47wasd = directions 87 83 65 68
49{-| Whether an arbitrary key is pressed. -}
50isDown : KeyCode -> Signal Bool
51isDown = Native.Keyboard.isDown
53{-| Whether the shift key is pressed. -}
57{-| Whether the control key is pressed. -}
61{-| Whether the space key is pressed. -}
65{-| Whether the enter key is pressed. -}
69{-| List of keys that are currently down. -}
70keysDown : Signal [KeyCode]
71keysDown = Native.Keyboard.keysDown
73{-| The latest key that has been pressed. -}
74lastPressed : Signal KeyCode
75lastPressed = Native.Keyboard.lastPressed
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