project_files/HedgewarsMobile/Classes/TeamConfigViewController.m
changeset 5976 306cedbeb213
parent 5208 878e551f0b4a
child 6078 8c0cc07731e5
equal deleted inserted replaced
5975:c3a8cab64fcb 5976:306cedbeb213
   100     }
   100     }
   101     return numberOfHogs;
   101     return numberOfHogs;
   102 }
   102 }
   103 
   103 
   104 -(UIImage *)drawHogsRepeated:(NSInteger) manyTimes {
   104 -(UIImage *)drawHogsRepeated:(NSInteger) manyTimes {
   105     UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:HEDGEHOG_FILE()];
   105     NSString *imgString = [[NSString alloc] initWithFormat:@"%@/hedgehog.png",[[NSBundle mainBundle] resourcePath]];
       
   106     UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:imgString];
       
   107     [imgString release];
   106     CGFloat screenScale = getScreenScale();
   108     CGFloat screenScale = getScreenScale();
   107     int w = hogSprite.size.width * screenScale;
   109     int w = hogSprite.size.width * screenScale;
   108     int h = hogSprite.size.height * screenScale;
   110     int h = hogSprite.size.height * screenScale;
   109     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
   111     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
   110     CGContextRef context = CGBitmapContextCreate(NULL, w * 3, h, 8, 4 * w * 3, colorSpace, kCGImageAlphaPremultipliedFirst);
   112     CGContextRef context = CGBitmapContextCreate(NULL, w * 3, h, 8, 4 * w * 3, colorSpace, kCGImageAlphaPremultipliedFirst);
   183         cell.textLabel.backgroundColor = [UIColor clearColor];
   185         cell.textLabel.backgroundColor = [UIColor clearColor];
   184         
   186         
   185         NSString *teamPath = [NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),cell.textLabel.text];
   187         NSString *teamPath = [NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),cell.textLabel.text];
   186         NSDictionary *firstHog = [[[NSDictionary dictionaryWithContentsOfFile:teamPath] objectForKey:@"hedgehogs"] objectAtIndex:0];
   188         NSDictionary *firstHog = [[[NSDictionary dictionaryWithContentsOfFile:teamPath] objectForKey:@"hedgehogs"] objectAtIndex:0];
   187         if ([[firstHog objectForKey:@"level"] intValue] != 0) {
   189         if ([[firstHog objectForKey:@"level"] intValue] != 0) {
   188             NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Settings/Images/robotBadge.png"];
   190             NSString *imgString = [[NSString alloc] initWithFormat:@"%@/robotBadge.png",[[NSBundle mainBundle] resourcePath]];
   189             UIImage *sprite = [[UIImage alloc] initWithContentsOfFile:filePath];
   191             UIImage *sprite = [[UIImage alloc] initWithContentsOfFile:imgString];
       
   192             [imgString release];
   190             UIImageView *spriteView = [[UIImageView alloc] initWithImage:sprite];
   193             UIImageView *spriteView = [[UIImageView alloc] initWithImage:sprite];
   191             [sprite release];
   194             [sprite release];
   192             
   195             
   193             cell.accessoryView = spriteView;
   196             cell.accessoryView = spriteView;
   194             [spriteView release];
   197             [spriteView release];