I am trying to play around with touches in cocos2d-x . I have question on the priority of the touches for example , When I use CCMenuItemSprite
or CCControlButton
which are added on the Layer which has setTouchEnabled(true)
or even If I put a
What I found is touch is not first given to ccTouchesBegan
(...I mean Layer) instead it is taken by CCMenuItemSprite
or CCCOntrolButton
call backs .
Moreover , If I add an extra layer top on all the layers and setTouchEnable
(True) same results I get
touches are first given to menuitem and control button which after touch swallows the touches.
Is there any way by which we can change the priority of touches ? or
Is there any way by which I can override CCControlButton
or CCMEnuItemSprite
...ccTouchesBegan or moved
after all I want the touch location of CCMenuItem
or CControlButton
otherwise I have to reconsider the CCSprite
?
overwrite your CCLayer's method
YOUR_LAYER::registerWithTouchDispatcher{
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, INT_MIN, true);
}