I am trying to catch all the menu events using a method that will identify which menu item was tapped based on its tag. However, in the callback method the tag is some random number, and not the number that I set.
1. create a new cocos2d-x project
2. in HelloWorld::init() add
pCloseItem->setTag(23);3. update the
menuCloseCallback to receive
(CCMenuItemImage* pSender) as parameter in the header and the implementation file
4. set a breakpoint inside the
When the breakpoint is hit, run
p pSender->getTag() in the debugger. Instead of getting 23, I am getting some random number.
Am I doing something wrong?