First, I want to explain why TexturePacker is used? This is because our game will eventually run on an Android or Apple mobile phone, while the Android or ios system uses OpenGL ES for rendering. So we need to optimize OpenGL ES. In terms of memory, the width and height of OpenGL ES textures are multiples of the n power of 2. Think about it. If the image width is 33 and the height is 65, what is the size after the image is loaded into the memory? Considering that the width and height are the n power of 2, the size after loading to the memory is 64*128. Therefore, we can consider combining small images into images and then loading them. In terms of rendering speed, OpenGL ES requires less texture to be switched, so the image is combined into a large image, which reduces texture switching. Therefore, it is necessary to use TexturePacker. Open TexturePacker and click Add Folder to load all the images. Note: We should put the image to be pieced together in the same folder. In this way. TexturePacker Automatically splits the image to be pieced together into a big image, and the width and height of the big image are multiples of the power of n of 2. Set the output format below: Texture format to PNG. Select the storage location of Data file and Texture file. Click Publis on the toolbar. In this way, we get the plist and png files. Below are the two files used in the cocos2d-x. Copy the two files to the Resources folder. Use the following code to load two files: [cpp] CCSpriteFrameCache: sharedSpriteFrameCache ()-> addSpriteFramesWithFile ("last. plist "," last.png "); CCSpriteFrameCache: sharedSpriteFrameCache ()-> addSpriteFramesWithFile (" last. plist "," last.png "); then create a CCSpriteBatchNode to load the sprite to be rendered to CCSpriteBatchNode. [Cpp] CCTexture2D * texture = CCTextureCache: sharedTextureCache ()-> textureForKey ("last.png"); worker * node = worker: batchNodeWithTexture (texture); addChild (node ); CCTexture2D * texture = CCTextureCache: sharedTextureCache ()-> textureForKey ("last.png"); worker * node = worker: batchNodeWithTexture (texture); addChild (node ); then, the Wizard is created and loaded. [Cpp] CCSprite * s1 = CCSprite: createWithSpriteFrameName ("bird.png"); s1-> setPosition (ccp (35, 32.5); node-> addChild (s1 ); CCSprite * s2 = CCSprite: createWithSpriteFrameName ("cat.png"); s2-> setPosition (ccp (100,100); node-> addChild (s2); CCSprite * s1 = CCSprite :: createWithSpriteFrameName ("bird.png"); s1-> setPosition (ccp (35, 32.5); node-> addChild (s1); CCSprite * s2 = CCSprite: createWithSpriteFrameName ("cat.png ") "); S2-> setPosition (ccp (100,100); node-> addchild(s2d.;;“bird.png" is the name of the small image. Note: Sprite in CCSpriteBatchNode must use the same texture.