X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJInputButton.m;h=44a0bebb90d2663d83d8e0bef3783f1382f87636;hp=0c3b0ce32de0105413d0d1c4e68c86be853e62b7;hb=e7c0b2d96e9e3209b5ba80cc1fdc8e7213cb5302;hpb=0064c1fbff36795885a9724081af2a17d83c20a3 diff --git a/Classes/NJInputButton.m b/Classes/NJInputButton.m index 0c3b0ce..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 { - if ((self = [super init])) { - _max = max; - if (name.length) - self.name = [NSString stringWithFormat:@"Button %d - %@", idx, name]; - else - self.name = [NSString stringWithFormat:@"Button %d", idx]; +- (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; }