I don’t know if I’m doing something wrong or if I don’t understand some concept here; but I had a problem with buttons (they didn’t respond) and it was because there were a virtual void onEnter() on the class.
Here is the relevant code:
virtual bool init();
virtual void onEnter(); // if I delete this, button works fine.
virtual void onExit();
void onMenuDn(CCObject* sender);
CCSprite* spriteOn = .....;
CCSprite* spriteOff = .....;
menu_btn = CCMenuItemSprite::create(spriteOff, spriteOn, this, menu_selector(Class::onMenuDn));
menu = CCMenu::create(menu_btn, NULL);
void Class::onMenuDn(CCObject* sender)
With onEnter() the button doesn’t work, but if take out the onEnter method the button works fine. Why is this happening? Is this a bug? or am I missing something?
Cocos version: cocos2d-x-2.2