Clean up a bunch of properties; remove unused ones, use automatic ones where possible...
[enjoyable.git] / JSActionButton.m
1 //
2 // JSActionButton.m
3 // Enjoy
4 //
5 // Created by Sam McCall on 5/05/09.
6 //
7
8 #import "JSActionButton.h"
9
10 @implementation JSActionButton {
11 int _max;
12 }
13
14 - (id)initWithName:(NSString *)name idx:(int)idx max:(int)max {
15 if ((self = [super init])) {
16 _max = max;
17 if (name.length)
18 self.name = [NSString stringWithFormat:@"Button %d - %@", idx, name];
19 else
20 self.name = [NSString stringWithFormat:@"Button %d", idx];
21 }
22 return self;
23 }
24
25 - (id)findSubActionForValue:(IOHIDValueRef)val {
26 return (IOHIDValueGetIntegerValue(val) == _max) ? self : nil;
27 }
28
29 - (void)notifyEvent:(IOHIDValueRef)value {
30 self.active = IOHIDValueGetIntegerValue(value) == _max;
31 }
32
33 @end