X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJInputButton.m;h=354220a739b784612e61d347b13e20103cc60f1e;hp=caa759b6844888358eda0a95c718fe58f0073d13;hb=561fa1774ce33b5a4a8112ba5802cc33a2ca819d;hpb=b417eb4ae97804070277eb19cc596bdb6bb9d281 diff --git a/Classes/NJInputButton.m b/Classes/NJInputButton.m index caa759b..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 { - NSString *fullname = [NSString stringWithFormat:NSLocalizedString(@"button %d", @"button name"), idx]; - if (name.length) - fullname = [fullname stringByAppendingFormat:@"- %@", name]; - NSString *did = [[NSString alloc] initWithFormat:@"Button %d", idx]; - if ((self = [super initWithName:fullname did:did base:nil])) { - _max = max; +- (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; }