X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JSActionButton.m;fp=JSActionButton.m;h=98a186a8b49d30d68eb6c3f0bd9e0697eeb1d1a5;hp=0000000000000000000000000000000000000000;hb=530009447c5bbd360ac5023979cffc6d32a28df3;hpb=5f07baa8cb03a2f6aa06338bfeb31dad3c3ca29f diff --git a/JSActionButton.m b/JSActionButton.m new file mode 100644 index 0000000..98a186a --- /dev/null +++ b/JSActionButton.m @@ -0,0 +1,31 @@ +// +// JSActionButton.m +// Enjoy +// +// Created by Sam McCall on 5/05/09. +// + +@implementation JSActionButton + +@synthesize max, active; + +-(id)initWithIndex: (int)newIndex andName: (NSString *)newName { + if(self= [ super init]) { + subActions = NULL; + index = newIndex; + name = [[NSString alloc] initWithFormat: @"Button %d %@", (index+1), newName]; + } + return self; +} + +-(id) findSubActionForValue: (IOHIDValueRef) val { + if(IOHIDValueGetIntegerValue(val) == max) + return self; + return NULL; +} + +-(void) notifyEvent: (IOHIDValueRef) value { + active = IOHIDValueGetIntegerValue(value) == max; +} + +@end