X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JSActionButton.m;h=7d2572a32a09f4a92c0074eed851fbcdc80975e1;hp=58503c82de69560f91c3d30f1b438d4d6c148a7a;hb=62aa5b73be6ec1e499e6b155cd0e7687c338cbaa;hpb=c6fb77859e508aaef686b7a5a6a12abe29178708 diff --git a/JSActionButton.m b/JSActionButton.m index 58503c8..7d2572a 100644 --- a/JSActionButton.m +++ b/JSActionButton.m @@ -8,30 +8,26 @@ #import "JSActionButton.h" @implementation JSActionButton { - BOOL active; + long _max; } -@synthesize max; -@synthesize active; - -- (id)initWithName:(NSString *)name_ idx:(int)idx max:(int)max_ { +- (id)initWithName:(NSString *)name idx:(int)idx max:(long)max { if ((self = [super init])) { - self.index = idx; - self.max = max_; - if (name_.length) - self.name = [NSString stringWithFormat:@"Button %d - %@", self.index, name_]; + _max = max; + if (name.length) + self.name = [NSString stringWithFormat:@"Button %d - %@", idx, name]; else - self.name = [NSString stringWithFormat:@"Button %d", self.index]; + self.name = [NSString stringWithFormat:@"Button %d", idx]; } return self; } - (id)findSubActionForValue:(IOHIDValueRef)val { - return (IOHIDValueGetIntegerValue(val) == max) ? self : nil; + return (IOHIDValueGetIntegerValue(val) == _max) ? self : nil; } - (void)notifyEvent:(IOHIDValueRef)value { - active = IOHIDValueGetIntegerValue(value) == max; + self.active = IOHIDValueGetIntegerValue(value) == _max; } @end