Game Development Reference
In-Depth Information
Even if the player variable were a member of the class (say, m_player ), you wouldn't
have to retain it to keep it in scope. By adding the object to some Cocos2d-x list or cache,
the object is automatically retained. So you may continue to address that memory through
its pointer:
m_player = Player::create();
this->addChild(m_player);//this will retain the object
//m_player still references the memory address
//but does not need to be released or deleted by you
Search WWH ::




Custom Search