equal
deleted
inserted
replaced
121 |
121 |
122 -(void) loadAmmoStuff:(id) object { |
122 -(void) loadAmmoStuff:(id) object { |
123 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
123 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
124 NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()]; |
124 NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()]; |
125 UIImage *ammoStoreImage = [[UIImage alloc] initWithContentsOfFile:str]; |
125 UIImage *ammoStoreImage = [[UIImage alloc] initWithContentsOfFile:str]; |
|
126 CGFloat theScale = [[UIScreen mainScreen] safeScale]; |
126 |
127 |
127 NSMutableArray *imgs = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()]; |
128 NSMutableArray *imgs = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()]; |
128 NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()]; |
129 NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:HW_getNumberOfWeapons()]; |
129 int i, j, e; |
130 int i, j, e; |
130 for (i = 0, j = 0, e = 0; i < HW_getNumberOfWeapons(); i++) { |
131 for (i = 0, j = 0, e = 0; i < HW_getNumberOfWeapons(); i++) { |
165 button.titleLabel.layer.borderColor = [[UIColor whiteColor] CGColor]; |
166 button.titleLabel.layer.borderColor = [[UIColor whiteColor] CGColor]; |
166 button.titleLabel.layer.borderWidth = 1; |
167 button.titleLabel.layer.borderWidth = 1; |
167 [self.view addSubview:button]; |
168 [self.view addSubview:button]; |
168 [array addObject:button]; |
169 [array addObject:button]; |
169 |
170 |
170 int size = 32 * [[UIScreen mainScreen] scale]; |
171 int size = 32 * theScale; |
171 int x_src = ((i*size)/(int)(ammoStoreImage.size.height * [[UIScreen mainScreen] scale]))*size; |
172 int x_src = ((i*size)/(int)(ammoStoreImage.size.height * theScale))*size; |
172 int y_src = (i*size)%(int)(ammoStoreImage.size.height * [[UIScreen mainScreen] scale]); |
173 int y_src = (i*size)%(int)(ammoStoreImage.size.height * theScale); |
173 UIImage *img = [ammoStoreImage cutAt:CGRectMake(x_src, y_src, size, size)]; |
174 UIImage *img = [ammoStoreImage cutAt:CGRectMake(x_src, y_src, size, size)]; |
174 [imgs addObject:img]; |
175 [imgs addObject:img]; |
175 } |
176 } |
176 [self performSelectorOnMainThread:@selector(setButtonsArray:) withObject:array waitUntilDone:NO]; |
177 [self performSelectorOnMainThread:@selector(setButtonsArray:) withObject:array waitUntilDone:NO]; |
177 [array release]; |
178 [array release]; |