Cocos2dx memory management, how to use destructors and when to release objects?

后端 未结 3 898
北恋
北恋 2020-12-17 17:05

I\'m reading around the web and the documentation but to be honest, I don\'t get it. Since I\'m new to cocos2d-x I would like to understand better how the objects are create

3条回答
  •  醉酒成梦
    2020-12-17 17:39

    Sorry,my English is poor!

    1.The this->sprite will be auto release when CCLayer destroy if you call CCSprite::create(...); and addChild(...); .

    2.if you want remove this->sprite sometimes ,you could call this:

    this->sprite->removeFormParents();
    this->sprite=NULL;
    

提交回复
热议问题