I am building an application using Box2D in which I get images from the asset library and display them as sprites.
here is the code i made:
Retrieving Images from the Resource Library:
CGImageRef imgRef = [[mutArrAssetPhotos objectAtIndex:i] thumbnail];
Creating Texture2D:
CCTexture2D *spriteTexture = [[CCTexture2D alloc]initWithCGImage:imgRef resolutionType:kCCResolutionUnknown];
Creating sprites from textures:
CCSprite *paddle = [CCSprite spriteWithTexture:spriteTexture];
This gives me a warning in the console, for example:
"cocos2d: CCTexture2D: Using RGB565 texture since image has no alpha"
It still works fine in the simulator, although it’s a warning, but the device’s images are not displayed.
But instead, if I used:
CCSprite *paddle = [CCSprite spriteWithFile:@"img.png"];
It works fine and gives no warning either.
Can anyone help? Thanks at Advance.