Cocos2dx scene Life Cycle (replacescene, popscene will be supplemented later)

Source: Internet
Author: User
Tags addchild

Tag: Flowchart

Cocos2dx in Multi-scenario switching, the effect of lifecycle printing is as follows:


Start from the myscene scenario, switch to the helloworld scenario, and then launch the helloworld scenario and flowchart (see attachment,. I don't know how to upload images, but I can't paste images, so I'm depressed ...)


Print the following log,


Myscene code: myscene () {cclog ("wangss -----------> myscene");} myscene ::~ Myscene () {cclog ("wangss -------------> ~~ Myscene ");} void myscene: onenter () {cclog (" wangss -----------> onenter "); layer: onenter ();} void myscene: onentertransitiondidfinish () {cclog ("wangss -----------> onentertransitiondidfinish");} void myscene: onexit () {cclog ("wangss -------------> onexit"); layer: onexit ();} void myscene: onexittransitiondidstart () {cclog ("wangss -------------> onexittransitiondidstart");} void myscene: cleanup () {cclog ("Wan GSS -------------> cleanup ");} SCENE * myscene: createscene () {cclog (" wangss -------------> createscene "); Auto scene = scene: Create (); auto layer = myscene: Create (); scene-> addchild (layer); Return scene;} bool myscene: Init () {cclog ("wangss -------------> init "); if (! Layer: Init () {return false;} size visiblesize = Director: getinstance ()-> getvisiblesize (); vec2 origin = Director: getinstance () -> getvisibleorigin (); // spritetest (visiblesize); // labeltest (visiblesize); // menutest (visiblesize); // receivagetest (visiblesize ); // scheduletest (visiblesize); // scaleninespritetest (visiblesize); // shujujiegoutest (visiblesize); // actiontest (visiblesize); // actioncallbacktest (Visiblesize); // frameanimationtest (visiblesize); // actioneasetest (visiblesize); // progressactiontest (visiblesize); merge (visiblesize); Return true;} helloworld code: helloworld :: helloworld () {cclog ("wangss ------ helloworld -------> helloworld");} helloworld ::~ Helloworld () {cclog ("wangss ------ helloworld -------> ~~ Helloworld ");} void helloworld: onenter () {cclog (" wangss ------ helloworld -------> onenter "); layer: onenter ();} void helloworld: onentertransitiondidfinish () {cclog ("wangss ------ helloworld -------> onentertransitiondidfinish");} void helloworld: onexit () {cclog ("wangss ------ helloworld -------> onexit"); layer :: onexit ();} void helloworld: onexittransitiondidstart () {cclog ("wangss ------ helloworld -------> onexittransitiondidstart");} void helloworld: cleanup () {cclog ("wangss ------ helloworld -------> cleanup");} SCENE * helloworld: createscene () {cclog ("wangss ------ helloworld -------> createscene "); // 'Scene 'is an autorelease object auto scene = scene: Create (); // 'player' is an autorelease object auto layer = helloworld: Create (); // Add layer as a child to scene-> addchild (layer); // return the scene return scene ;}

11-02 15:09:40. 290: D/cocos2d-x debug info (23066): wangss -------------> createscene

11-02 15:09:40. 300: D/cocos2d-x debug info (23066): wangss -------------> myscene

11-02 15:09:40. 300: D/cocos2d-x debug info (23066): wangss -------------> init

11-02 15:09:40. 320: D/cocos2d-x debug info (23066): wangss -------------> onenter

11-02 15:09:40. 320: D/cocos2d-x debug info (23066): wangss -------------> onentertransitiondidfinish

11-02 15:09:43. 640: D/cocos2d-x debug info (23066): wangss ------ helloworld -------> createscene

11-02 15:09:43. 640: D/cocos2d-x debug info (23066): wangss ------ helloworld -------> helloworld

11-02 15:09:43. 640: D/cocos2d-x debug info (23066): wangss ------ helloworld -------> init

11-02 15:09:43. 760: D/cocos2d-x debug info (23066): wangss -------------> onexittransitiondidstart

11-02 15:09:43. 760: D/cocos2d-x debug info (23066): wangss ------ helloworld -------> onenter

11-02 15:09:44. 940: D/cocos2d-x debug info (23066): wangss -------------> onexit

11-02 15:09:44. 940: D/cocos2d-x debug info (23066): wangss ------ helloworld -------> onentertransitiondidfinish

11-02 15:09:44. 940: D/cocos2d-x debug info (23066): wangss -------------> cleanup

11-02 15:09:44. 940: D/cocos2d-x debug info (23066): wangss -------------> ~~ Myscene

11-02 15:09:46. 220: D/cocos2d-x debug info (23066): wangss ------ helloworld -------> onexit

11-02 15:09:46. 220: D/cocos2d-x debug info (23066): wangss ------ helloworld -------> cleanup

11-02 15:09:46. 220: D/cocos2d-x debug info (23066): wangss ------ helloworld -------> ~~ Helloworld




Cocos2dx scene Life Cycle (replacescene, popscene will be supplemented later)

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.