crashed at - CCAssert( child~~>m_pParent == NULL, “child already added. It can’t be added again”);
I looked classes CCMenuItem, CCMenuItemImage, CCMenuItemSprite…
and found that all classes don’t have copy constructor~~ declaration, definition or
explicit prohibition copying (something like this:
class T {
private:
Т( const T& ); // without definition
Т& operator=( const T& ); // without definition
};
)
This look like a bug. Maybe i’m wrong? Maybe correct way to copy MenuItems objects exist?
…
void MenuScene::menuCloseCallback(CCObject* sender)
{
member~~>DoStuff;
}
It makes sense, since the callback is referring to class method instead of the method of an instance. But is there any way to reference the object’s member? I tried wrapping with another class function:
void MenuScene::DoStuff
{
member~~>DoStuff();
}
I setup a callback to: MenuScene::menuCloseCallback
it’s referring to a class method, not an object method.
It’s fine, I just have to reimplement MenuScene as a singleton and maybe do something like this:
void MenuScene::menuCloseCallback(CCObject* sender)
{
sharedInstance()>member>DoStuff();
}
I don’t know if I catch your idea.
Callback of MenuScene::menuCloseCallback is not a class method. You can refer HelloWorld, menuCloseCallback is not a class method.
How does it know which “MenuScene::menuCloseCallback” to call? For example, say I had two instances (not that I would). So if I had two instances, would I get two calls to MenuScene::menuCloseCallback? One for each instance?
If I break inside of MenuScene::menuCloseCallback and take a look at ‘member’, which is a pointer to a derived class of CCSprite, it’s a bad pointer.
It can not used in this way. As fact, only the classes that inherit from SelectorProtocol can use it. And it points the object that use the menu_selector.