Created
October 1, 2011 16:36
-
-
Save l4u/1256288 to your computer and use it in GitHub Desktop.
cocos2d-x prevent touch propagation to other layers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UpdateLayer.cpp | |
// prevent touch propagation to other layers | |
// cocos2d-1.0.1-x-0.9.1 | |
void UpdateLayer::onEnter() | |
{ | |
CCLayer::onEnter(); | |
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, 0, true); | |
... | |
} | |
void UpdateLayer::onExit() | |
{ | |
CCTouchDispatcher::sharedDispatcher()->removeDelegate(this); | |
CCLayer::onExit(); | |
} | |
bool UpdateLayer::ccTouchBegan(CCTouch* pTouch, CCEvent* pEvent) | |
{ | |
CCLOG("Prevent Touch Propagation in Update Layer"); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment