I have a problem with cocos2d-x touch handler. I have two CCLayers
. The first layer is the main application and the second one is a toolbox. The toolbox can slide over the first layer. main application has a special touch handling and the toolbox has touch handling too. When I slide down the toolbox and click on it, cocos2d-x runs the main application events and handlers. I want to run the toolbox handler functions when I click on it and I need to run main application handlers when I click on it too. How can I solve this problem?
In your CCLayer toolbox, override function registerWithTouchDispatcher()
to set the touch priority to be highest.
void ToolBoxLayer::registerWithTouchDispatcher()
{
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, numeric_limits <int> ::min(), true);
}