X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJInputButton.m;h=44a0bebb90d2663d83d8e0bef3783f1382f87636;hp=caa759b6844888358eda0a95c718fe58f0073d13;hb=794a6e8c99be447b2ebc2b5510f7bf8ddeb4d75d;hpb=79b05c3cf1c75bc4f7078acde43aaf4215c6408a diff --git a/Classes/NJInputButton.m b/Classes/NJInputButton.m index caa759b..44a0beb 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_EID("Button", index) + element:element + parent:parent])) { + _max = IOHIDElementGetLogicalMax(element); } return self; }