Cocos2dx scene, layer, Sprite

Source: Internet
Author: User

Layer, scene, and sprite all have 0.5, 0.5 by default.

All of the three are inherited from the node, so there is no difference at the moment, or the following is true.

In the cocos2d-x, one application can have multiple scene, but only one is acitve at any time.

A ccscene consists of multiple ccnodes. Generally, it contains several cclayers, and cclayers contain multiple ccsprite.

It should be noted that ccscene, cclayer, and ccsprite all inherit ccnode, except that the latter has other parent classes which are implemented using multi-inheritance.

It is known that the visual data organization of the cocos2d-x is a scene tree, but some of the intermediate nodes are given additional logic (such as ccscene and cclayer)

Auto visiblesize = Director: getinstance ()->Getvisiblesize (); Sprite* SPR = sprite: Create ("Bang.png"); SPR->Setposition (vec2 (visiblesize. Width, visiblesize. Height); scene-> Addchild (SPR );

The _ eventdispatcher In the director class of node indicates that _ eventdispatcher is a singleton,

 
{// Node class constructor // set default scheduler and actionmanager Director * Director = Director: getinstance (); _ actionmanager = Director-> getactionmanager (); _ actionmanager-> retain (); _ schedctor = Director-> getscheduler (); _ scheduler-> retain (); _ eventdispatcher = Director-> geteventdispatcher (); _ eventdispatcher-> retain ();}

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.