views:

374

answers:

1

Hi all,

I am totally in confusion. Apple told that in iPhone 4 one can use high resolution image... than the standard one.So i use 2 image([email protected] and image.png)...

[email protected] has 50*50 dimension and 72 resolution image.png has 25*25 dimension and 72 resolution

than when i run the code

UIImage *image = [ UIImage imageNamed:@"a.png"];
            CCTexture2D  *tex = [ [CCTexture2D alloc] initWithImage:image ];
            [image release];

            CCSprite *u = [CCSprite spriteWithTexture:tex  rect:CGRectMake(0, 0,25, 25)];

in iPhone 4 i think [email protected] should load and it loaded but the image is cut...i don't get the full image......

but when i take this...

[email protected] has 25*25 dimension and 144 resolution image.png has 25*25 dimension and 72 resolution

the image didn't cut and all ok......don't know why??

Another thing....when i use this..

UIImageView *imageView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BGS.png"]];
[self.view addSubview:imageView];
[imageView release];

it works as like apple said....then is it the prob with cocos2d?? i am using cocos2d.99.4..

+1  A: 

Cocos2d textures use the CGImage property of the UIImage. The scale factor of CGImages is assumed to be 1, but on a iPhone 4 UIImages have a scale factor of 2, so this is why you see the cropping that you do.

What version of cocos2d are you using? v0.99.4 has support for retina display, so just upgrading your library may fix your issue.

Don