X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JSActionButton.m;h=c74c0e295ea01bbd345ee00ef155f21e4db9272d;hp=58503c82de69560f91c3d30f1b438d4d6c148a7a;hb=03b4a589de71a49ad00450701630673631e88647;hpb=c6fb77859e508aaef686b7a5a6a12abe29178708 diff --git a/JSActionButton.m b/JSActionButton.m index 58503c8..c74c0e2 100644 --- a/JSActionButton.m +++ b/JSActionButton.m @@ -8,30 +8,26 @@ #import "JSActionButton.h" @implementation JSActionButton { - BOOL active; + int _max; } -@synthesize max; -@synthesize active; - -- (id)initWithName:(NSString *)name_ idx:(int)idx max:(int)max_ { +- (id)initWithName:(NSString *)name idx:(int)idx max:(int)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