equal
deleted
inserted
replaced
23 self.hatArray = array; |
23 self.hatArray = array; |
24 |
24 |
25 // load all the hat images from the previous array but save only the first sprite and store it in hatSprites |
25 // load all the hat images from the previous array but save only the first sprite and store it in hatSprites |
26 NSMutableArray *spriteArray = [[NSMutableArray alloc] initWithCapacity:[hatArray count]]; |
26 NSMutableArray *spriteArray = [[NSMutableArray alloc] initWithCapacity:[hatArray count]]; |
27 for (int i=0; i< [hatArray count]; i++) { |
27 for (int i=0; i< [hatArray count]; i++) { |
28 NSString *hatFile = [hatPath stringByAppendingString:[hatArray objectAtIndex:i]]; |
28 NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/Data/Graphics/Hats/%@",[[NSBundle mainBundle] resourcePath],[hatArray objectAtIndex:i]]; |
29 |
29 |
30 UIImage *image = [[UIImage alloc] initWithContentsOfFile: hatFile]; |
30 UIImage *image = [[UIImage alloc] initWithContentsOfFile: hatFile]; |
|
31 [hatFile release]; |
31 CGRect firstSpriteArea = CGRectMake(0, 0, 32, 32); |
32 CGRect firstSpriteArea = CGRectMake(0, 0, 32, 32); |
32 CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], firstSpriteArea); |
33 CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], firstSpriteArea); |
33 [image release]; |
34 [image release]; |
34 |
35 |
35 UIImage *hatSprite = [[UIImage alloc] initWithCGImage:cgImgage]; |
36 UIImage *hatSprite = [[UIImage alloc] initWithCGImage:cgImgage]; |