I need to make a modal dialog(inherited from CCLayer) that is showing in the center of the main layer. While it is showing, you can not press any other button outside the dialog. Just like a normal modal window in MS Windows System.
The problem is that I can not figure out how to disable the mainlayer's touch events while the dialog is showing.
Any help would be aprreciated.
This works for me in Cocos2d-x but can be adapted to Cocos2d too.
I've change setParent to:
And added the following recursive code to save the touch delegates so I can restore them when the dialog dismissed:
Just set
in the main layer while the popup is displayed. Then later set it back to YES.