@@ -20,30 +20,31 @@ import Signal (Signal)
2020import Native.Keyboard
2121
2222{-| Type alias to make it clearer what integers are supposed to represent
23− in this library. Use [`Char.toCode`](docs/Char.elm#toCode) and
24− [`Char.fromCode`](/docs/Char.elm#fromCode) to convert key codes to characters.
25− Use the uppercase character with `toCode`. -}
23+in this library. Use [`Char.toCode`](docs/Char.elm#toCode) and
24+[`Char.fromCode`](/docs/Char.elm#fromCode) to convert key codes to characters.
25+Use the uppercase character with `toCode`.
26+-}
2627type KeyCode = Int
2728
2829{-| Custom key directions to support different locales. The order is up, down,
29−left, right. -}
30−-- The plan is to have a locale independent version of this function
31−-- that uses the physical location of keys, but I don't know how to do it.
30+left, right.
31+-}
3232directions : KeyCode -> KeyCode -> KeyCode -> KeyCode -> Signal { x:Int, y:Int }
3333directions = Native.Keyboard.directions
3434
3535{-| A signal of records indicating which arrow keys are pressed.
3636
37− `{ x = 0, y = 0 }` when pressing no arrows.<br>
38− `{ x =-1, y = 0 }` when pressing the left arrow.<br>
39− `{ x = 1, y = 1 }` when pressing the up and right arrows.<br>
40− `{ x = 0, y =-1 }` when pressing the down, left, and right arrows.
37+`{ x = 0, y = 0 }` when pressing no arrows.<br>
38+`{ x =-1, y = 0 }` when pressing the left arrow.<br>
39+`{ x = 1, y = 1 }` when pressing the up and right arrows.<br>
40+`{ x = 0, y =-1 }` when pressing the down, left, and right arrows.
4141-}
4242arrows : Signal { x:Int, y:Int }
4343arrows = directions 38 40 37 39
4444
4545{-| Just like the arrows signal, but this uses keys w, a, s, and d,
46−which are common controls for many computer games. -}
46+which are common controls for many computer games.
47+-}
4748wasd : Signal { x:Int, y:Int }
4849wasd = directions 87 83 65 68
4950