I have read some solutions on how to make modal layer.
All of them saying that modal layer should just have highest touch dispatcher priority;
So i’ve declared my layer like this:
class ModalLayer: public CCLayerColor
{
public:
ModalLayer() {}
virtual ~ ModalLayer() {}
virtual bool init()
{
if ( !this->CCLayerColor::initWithColor(ccc4BFromccc4F(ccc4f(0,0,0,0))) )
return false;
this->setTouchEnabled(true);
return true;
}
virtual bool ccTouchBegan(CCTouch *touch, CCEvent *event)
{
return true;
}
virtual void registerWithTouchDispatcher()
{
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate( this,
INT_MIN+1,
true );
}
};
it has maximum priority, but it gives literally no effect. Anything under transparent parts of this layer still gets touch callbacks (like menu items and etc).
Ideally i want to create true modal layer without modifying cocos code, and without things like manually disabling touchEnabled flag for all items beside this particular layer.
Is this even achievable?