There are a layer which support mutiTouch. At first,it can response the mothed “ccTouchBegan” and then response “ccTouchesBegan”. Let’s call it “fatherLayer”.
When I add another layer “childLayer” on it and remove the “childLayer”, the fatherLayer is only response “ccTouchBegan” but never response “ccTouchesBegan”. I wonder why it is.
The “fatherLayer” like this:
bool fatherLayer::ccTouchBegan(CCTouch *touch,CCEvent *events)//This mothed can always be respond.
{ CCLog("=== ccTouchBegan -- 1");
return false; //If there is "return true", it will never response "ccTouchesBegan".
}
void fatherLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent){
switch (pTouches->count()) {
case 1: {
CCLog("=== ccTouchesBegan case1 -- 1");
return;
} break;
case 2: {
CCLog("=== ccTouchesBegan case2 -- 1");
return;
} break;
}
}
The childLayer
bool childLayer::ccTouchBegan(cocos2d::CCTouch* touch, cocos2d::CCEvent* events){
return true;
}
The two class both implement CCLayer.
Is someone know the reason? Thanks.