Remove website, now in yukkurigames.com repository.
[enjoyable.git] / Classes / NJInputButton.m
index 0c3b0ce..44a0beb 100644 (file)
@@ -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;
 }