X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JSActionButton.m;h=c74c0e295ea01bbd345ee00ef155f21e4db9272d;hp=f6a0fa76f003edc5ab89c3242c64e245de4f9bde;hb=15a3aec049658f4a1c3c6e8c9f8a549fb8de0782;hpb=3f6df7a954fb74bcebf6fc6c0e60821843b0f31b diff --git a/JSActionButton.m b/JSActionButton.m index f6a0fa7..c74c0e2 100644 --- a/JSActionButton.m +++ b/JSActionButton.m @@ -5,31 +5,29 @@ // Created by Sam McCall on 5/05/09. // +#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