Ccsprite is the most commonly used class. It uses images to display the Sprite on the screen. There are three ways to create the sprite ):
// 1. Create a file directly through ccspriteGenie
Ccsprite * sprit = [ccsprite spritewithfile: @ "1.jpg"];
Cgsize size = [[ccdirector shareddire] winsize];
Sprit. Position = CCP (size. Width, size. Height );
Sprit. anchorpoint = CCP (1, 1 );
[Self addchild: sprit];
// 2. Use texture to create a genie and store it in the cache
Cctexture2d * Tx = [[cctexturecache sharedtexturecache] addimage: @ "1.jpg"];
Ccsprite * txsprite = [ccsprite spritewithtexture: TX];
Cgsize size = [[ccdirector shareddire] winsize];
Txsprite. Position = CCP (size. width/4, size. Height/4 );
[Self addchild: txsprite];
// Retrieve images from the cache to save memory
Cctexture2d * tx2 = [[cctexturecache sharedtexturecache] textureforkey: @ "1.jpg"];
Ccsprite * txsprite2 = [ccsprite spritewithtexture: tx2];
Txsprite2.position = CCP (size. Width * 3/4, size. Height/4 );
[Self addchild: txsprite2];
// 3. Obtain the image from the texture set
[[Ccspriteframecache sharedspriteframecache] addspriteframeswithfile: @ "untitled_default.plist"];
Ccsprite * sprite = [ccsprite spritewithspriteframename: @ "5.jpg"];
Cgsize size = [[ccdirector shareddire] winsize];
Sprite. Position = CCP (size. width/4, size. Height/4 );
[Self addchild: SPRITE];