I have a Scene that has to Layers that extend LayerColor.
I set them visible or not, circumstance depending.
But how do I make EventDispatch throw the right event on a touch. Example. If I have
Layer1->setVisible(false)
Layer2->setVisible(true)
Then I touch Layer 1, the event for Layer 1 is firing.
The Layers have events
auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE);
listener->setSwallowTouches(true);
listener->onTouchBegan = [&](cocos2d::Touch* touch, cocos2d::Event* event)
{
OrdersLayer::touchEvent(touch);
return true;
};
EventDispatcher::getInstance()->addEventListenerWithFixedPriority(listener, 31);
Can anyone help me understand how to manipulate EventDispatch how I want?