5 // Created by Sam McCall on 5/05/09.
8 #import "NJInputButton.h"
10 @implementation NJInputButton {
14 - (id)initWithName:(NSString *)name idx:(int)idx max:(long)max {
15 NSString *fullname = [NSString stringWithFormat:NSLocalizedString(@"button %d", @"button name"), idx];
17 fullname = [fullname stringByAppendingFormat:@"- %@", name];
18 NSString *did = [[NSString alloc] initWithFormat:@"Button %d", idx];
19 if ((self = [super initWithName:fullname did:did base:nil])) {
25 - (id)findSubInputForValue:(IOHIDValueRef)val {
26 return (IOHIDValueGetIntegerValue(val) == _max) ? self : nil;
29 - (void)notifyEvent:(IOHIDValueRef)value {
30 self.active = IOHIDValueGetIntegerValue(value) == _max;
31 self.magnitude = IOHIDValueGetIntegerValue(value) / (float)_max;