project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
changeset 6078 8c0cc07731e5
parent 5976 306cedbeb213
child 6209 074ab6ebcb3e
equal deleted inserted replaced
6077:d8fa5a85d24f 6078:8c0cc07731e5
    18  * File created on 19/06/2010.
    18  * File created on 19/06/2010.
    19  */
    19  */
    20 
    20 
    21 
    21 
    22 #import "SingleWeaponViewController.h"
    22 #import "SingleWeaponViewController.h"
    23 #import "CommodityFunctions.h"
    23 
    24 #import "UIImageExtra.h"
       
    25 #import "PascalImports.h"
       
    26 
    24 
    27 @implementation SingleWeaponViewController
    25 @implementation SingleWeaponViewController
    28 @synthesize weaponName, description, ammoStoreImage;
    26 @synthesize weaponName, description, ammoStoreImage;
    29 
    27 
    30 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
    28 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
   163         if (weaponCell == nil) {
   161         if (weaponCell == nil) {
   164             weaponCell = [[[WeaponCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
   162             weaponCell = [[[WeaponCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
   165             weaponCell.delegate = self;
   163             weaponCell.delegate = self;
   166         }
   164         }
   167 
   165 
   168         int size = 32 * getScreenScale();
   166         int size = 32 * [[UIScreen mainScreen] scale];
   169         int corners = 8 * getScreenScale();
   167         int corners = 8 * [[UIScreen mainScreen] scale];
   170         int x = ((row*size)/(int)(self.ammoStoreImage.size.height*getScreenScale()))*size;
   168         int x = ((row*size)/(int)(self.ammoStoreImage.size.height * [[UIScreen mainScreen] scale]))*size;
   171         int y = (row*size)%(int)(self.ammoStoreImage.size.height*getScreenScale());
   169         int y = (row*size)%(int)(self.ammoStoreImage.size.height * [[UIScreen mainScreen] scale]);
   172 
   170 
   173         UIImage *img = [[self.ammoStoreImage cutAt:CGRectMake(x, y, size, size)] makeRoundCornersOfSize:CGSizeMake(corners, corners)];
   171         UIImage *img = [[self.ammoStoreImage cutAt:CGRectMake(x, y, size, size)] makeRoundCornersOfSize:CGSizeMake(corners, corners)];
   174         weaponCell.weaponIcon.image = img;
   172         weaponCell.weaponIcon.image = img;
   175         weaponCell.weaponName.text = [NSString stringWithUTF8String:HW_getWeaponNameByIndex(row)];
   173         weaponCell.weaponName.text = [NSString stringWithUTF8String:HW_getWeaponNameByIndex(row)];
   176         weaponCell.tag = row;
   174         weaponCell.tag = row;