@@ -4,7 +4,7 @@
5module Keyboard where
5module Keyboard where
7−import Native.Keyboard
7+import Native.Keyboard as N
9type KeyCode = Int
9type KeyCode = Int
@@ -15,26 +15,26 @@ type KeyCode = Int
15-- `{ x = 1, y = 1 }` when pressing the up and right arrows.
15-- `{ x = 1, y = 1 }` when pressing the up and right arrows.
16-- `{ x = 0, y =-1 }` when pressing the down, left, and right arrows.
16-- `{ x = 0, y =-1 }` when pressing the down, left, and right arrows.
17arrows : Signal { x:Int, y:Int }
17arrows : Signal { x:Int, y:Int }
18−arrows = Native.Keyboard.dir 37 39 38 40
18+arrows = N.directions 37 39 38 40
20-- Just like the arrows signal, but this uses keys w, a, s, and d,
20-- Just like the arrows signal, but this uses keys w, a, s, and d,
21-- which are common controls for many computer games.
21-- which are common controls for many computer games.
22wasd : Signal { x:Int, y:Int }
22wasd : Signal { x:Int, y:Int }
23−wasd = Native.Keyboard.dir 65 68 87 83
23+wasd = N.directions 65 68 87 83
25+directions : KeyCode -> KeyCode -> KeyCode -> KeyCode -> Signal { x:Int, y:Int }
27isDown : KeyCode -> Signal Bool
28isDown : KeyCode -> Signal Bool
28−isDown = Native.Keyboard.isDown
30-- Whether the shift key is pressed.
30-- Whether the shift key is pressed.
31shift : Signal Bool
31shift : Signal Bool
32−shift = Native.Keyboard.isDown 16
32+shift = N.isDown 16
34-- Whether the control key is pressed.
34-- Whether the control key is pressed.
35ctrl : Signal Bool
35ctrl : Signal Bool
36−ctrl = Native.Keyboard.isDown 17
36+ctrl = N.isDown 17
38-- Whether the space key is pressed.
38-- Whether the space key is pressed.
39space : Signal Bool
39space : Signal Bool
40−space = Native.Keyboard.isDown 32
40+space = N.isDown 32