CCSprite is a two-dimensional image object. It can be defined by an image or a rectangle of an image. The inheritance relationship of CCSprite is as follows:
1: CCTexture2D
The texture class CCTexture2D is about OpenGL. The CCTexture2D class is the foundation of the sprite class and its related classes. In OpenGL, the image is called texture. In the Cocos2D-x, CCTexture2D is the meaning of the image object.
2: spritebatchnode
Purpose: Only one preparation, one rendering, and one cleanup of the same texture to be rendered.
3: CCSpriteFrame
The concept of a Sprite frame is relative to an animation. A Sprite is a fixed node that can have many ccspriteframes, and an animation is formed by switching between them. The CCSpriteFrame class can be defined by textures or part of textures, you can use the setDisplayFrame function of the genie to set the currently displayed sprite frame.
4: CCSpriteFrameCache
The cache class CCSpriteFrameCache is used to store genie frames. caching in advance helps improve program efficiency. CCSpriteFrameCache is a singleton mode and does not belong to a certain genie.
5. Example: The test project, SpriteTest contains related code.