Navigation Menu

Skip to content

Commit

Permalink
Added Color component; needed in the example
Browse files Browse the repository at this point in the history
Updated the examples to add some missing components. Although it doesn't appear that explicitly defining the Keyboard component causes any problems, it is a problem when you leave out the Color component.
  • Loading branch information
jon-lewis committed Aug 30, 2015
1 parent e0233ce commit 279f532
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/documentation/keyboard.md
Expand Up @@ -43,7 +43,7 @@ You might well need more control than the above components provide. To respond

```
Crafty.init();
Crafty.e('2D, Canvas, Keyboard')
Crafty.e('2D, Canvas, Color, Keyboard')
.attr({x: 10, y: 10, h: 30, w: 30})
.color('red')
.bind("KeyDown", function() {
Expand All @@ -54,7 +54,7 @@ Crafty.e('2D, Canvas, Keyboard')
The various [keyboard events](/api/KeyboardEvent.html) will be passed information about the original DOM event, and Crafty provides a [dictionary of key codes](/api/Crafty-keys.html) for convenience. In the following example, we create a square that can be moved by the arrow keys:

```
Crafty.e("2D, Canvas, Color")
Crafty.e("2D, Canvas, Color, Keyboard")
.attr({x: 10, y: 10, w: 30, h: 30})
.color("red")
.bind('KeyDown', function(e) {
Expand Down

0 comments on commit 279f532

Please sign in to comment.