@@ -43,6 +43,12 @@ Elm.Keyboard = { Raw : function() {
4343 }()
4444};
4545
46+/*! Keyboard
47+These are nicely curated inputs from the keyboard. See the
48+[Keyboard.Raw library](/docs/Signal/KeyboardRaw.elm) for a
49+lower-level interface that will let you define more complicated behavior.
50+!*/
51+
4652(function() {
4753 function keySignal(f) {
4854 var signal = Elm.Signal.lift(f)(Elm.Keyboard.Raw.keysDown);
@@ -79,10 +85,39 @@ Elm.Keyboard = { Raw : function() {
7985 return keySignal(f);
8086 }
8187
88+ /*[Directions]*/
89+
90+ /** arrows : Signal { x:Int, y:Int }
91+ A signal of records indicating which arrow keys are pressed.
92+
93+ `{ x = 0, y = 0 }` when pressing no arrows.
94+ `{ x =-1, y = 0 }` when pressing the left arrow.
95+ `{ x = 1, y = 1 }` when pressing the up and right arrows.
96+ `{ x = 0, y =-1 }` when pressing the down, left, and right arrows.
97+ **/
8298 Elm.Keyboard.arrows = dir(37,39,38,40);
99+
100+ /** wasd : Signal { x:Int, y:Int }
101+ Just like the arrows signal, but this uses keys w, a, s, and d,
102+ which are common controls for many computer games.
103+ **/
83104 Elm.Keyboard.wasd = dir(65,68,87,83);
105+
106+ /*[Modifiers]*/
107+
108+ /** shift : Signal Bool
109+ Whether the shift key is pressed.
110+ **/
84111 Elm.Keyboard.shift = is(16);
112+
113+ /** ctrl : Signal Bool
114+ Whether the control key is pressed.
115+ **/
85116 Elm.Keyboard.ctrl = is(17);
117+
118+ /** space : Signal Bool
119+ Whether the space key is pressed.
120+ **/
86121 Elm.Keyboard.space = is(32);
87122
88123}());