KoboldKit/KoboldKit — pull request #12 by samgreen (2013-12-20 21:44:35+00:00)
Title: Added KKInputKeyboardBehavior

This makes binding keys to actions ultra simple as a behavior. Simply add the behavior to a `KKNode` or `KKScene`

KKInputKeyboardBehavior *input = [KKInputKeyboardBehavior behavior];
[self addBehavior:input withKey:@"input"];
[input bindKey:@" " toAction:@"jump"];

Then you can check the exact status of a key in any update method:

KKInputKeyboardBehavior *input = (KKInputKeyboardBehavior *)[self behaviorForKey:@"input"];
if ([input keyState:@"jump"]) {
NSLog(@"jump DOWN");
}
if ([input keyPressed:@"jump"]) {
NSLog(@"jump PRESSED");
}
if ([input keyReleased:@"jump"]) {
NSLog(@"jump RELEASED");
}