X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJInputButton.m;h=354220a739b784612e61d347b13e20103cc60f1e;hp=caa4d8e55c54ba1824ecd957228defab821f5c3d;hb=58ce8f7f50f382f18e7b416eca737803af284868;hpb=235c087385a6e959ba7edefe4a3cbbbc00b2a534 diff --git a/Classes/NJInputButton.m b/Classes/NJInputButton.m index caa4d8e..354220a 100644 --- a/Classes/NJInputButton.m +++ b/Classes/NJInputButton.m @@ -8,16 +8,18 @@ #import "NJInputButton.h" @implementation NJInputButton { - long _max; + CFIndex _max; } -- (id)initWithName:(NSString *)name idx:(int)idx max:(long)max { - if ((self = [super init])) { - _max = max; - self.name = [NSString stringWithFormat:NSLocalizedString(@"button %d", @"button name"), idx]; - - if (name.length) - self.name = [self.name stringByAppendingFormat:@"- %@", name]; +- (id)initWithElement:(IOHIDElementRef)element + index:(int)index + parent:(NJInputPathElement *)parent +{ + if ((self = [super initWithName:NJINPUT_NAME(NSLocalizedString(@"button %d", @"button name"), index) + eid:NJINPUT_DID("Button", index) + element:element + parent:parent])) { + _max = IOHIDElementGetLogicalMax(element); } return self; }