CCSprite of coco2d-x core class and its related classes

Source: Internet
Author: User

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.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.