in cocos2d-x 3.0alpha
Layer::setTouchPriority was removed in 3.0alpha.
The priority of layer is based on the its draw order by default.
If you wish to use a fixed priority, you should
void YourLayer::onEnter()
{
Layer::onEnter();
xxxxx
auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE);
listener->setSwallowTouches(_swallowsTouches);
listener->onTouchBegan = CC_CALLBACK_2(Layer::onTouchBegan, this);
listener->onTouchMoved = CC_CALLBACK_2(Layer::onTouchMoved, this);
listener->onTouchEnded = CC_CALLBACK_2(Layer::onTouchEnded, this);
listener->onTouchCancelled = CC_CALLBACK_2(Layer::onTouchCancelled, this);
dispatcher->addEventListenerWithFixedPriority(listener, fixedValue); // Fixed value you wish. The lower the value is, the high priority you will get.
_touchListener = listener;
}
Thanks, I think the priority based on the draw order is a good idea!