X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JSActionHat.m;h=174d2df484b406eaa19ee9dd99ef54f2e856673c;hp=41d372870a33a519497adc4fdbde75e1b8bf57cd;hb=c262a3d0972ba16257fd24a948ab04f528f80d33;hpb=3f6df7a954fb74bcebf6fc6c0e60821843b0f31b diff --git a/JSActionHat.m b/JSActionHat.m index 41d3728..174d2df 100644 --- a/JSActionHat.m +++ b/JSActionHat.m @@ -5,6 +5,8 @@ // Created by Sam McCall on 5/05/09. // +#import "JSActionHat.h" + static BOOL active_eightway[36] = { NO, NO, NO, NO , // center YES, NO, NO, NO , // N @@ -27,14 +29,13 @@ static BOOL active_fourway[20] = { @implementation JSActionHat -- (id)init { +- (id)initWithIndex:(int)index { if ((self = [super init])) { - self.children = @[[[JSAction alloc] initWithName:@"Up" base: self], - [[JSAction alloc] initWithName:@"Down" base: self], - [[JSAction alloc] initWithName:@"Left" base: self], - [[JSAction alloc] initWithName:@"Right" base: self]]; - // TODO(jfw): Should have an indexed name, like everything else. - self.name = @"Hat switch"; + self.children = @[[[JSAction alloc] initWithName:@"Up" base:self], + [[JSAction alloc] initWithName:@"Down" base:self], + [[JSAction alloc] initWithName:@"Left" base:self], + [[JSAction alloc] initWithName:@"Right" base:self]]; + self.name = [NSString stringWithFormat:@"Hat Switch %d", index]; } return self; }