Question about Touch Event

I knew that cocos2d has two way of handling touch event

CCStandardTouchDelegate and
CCTargetedTouchDelegate

I can understand handling touch event with CCStandardTouchDelegate.

virtual void ccTouchesBegan(CCSet pTouches, CCEventpEvent);
virtual void ccTouchesMoved(CCSet pTouches, CCEventpEvent);
virtual void ccTouchesEnded(CCSet pTouches, CCEventpEvent);
virtual void ccTouchesCancelled(CCSet pTouches, CCEventpEvent);

but the problem is CCTargetedTouchDelegate because when i overrided
below method

void CCLayer::registerWithTouchDispatcher()
{
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,INT_MIN+1,true);
}

got error after touch the screen.

help.

Can your paste the error log, and the code snip which raise this error?

I think your problem looks like this:
http://www.cocos2d-x.org/boards/6/topics/2174?r=2179#message-2179

I just added below 5 linees in the HellowWorld sample code.

@
#HelloWorld.h
void HelloWorld::registerWithTouchDispatcher();

#HellowWorldScene.cpp
void HelloWorld::registerWithTouchDispatcher()
{
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,0,true);
}
@

and the error message is

“Assertion failed!
program:…
File : … cclayer.cpp
Line : 256
Expression:false

and debugger stopped at line 83

74 CCTexture2D::~CCTexture2D()
75 {
76 #if CC_ENABLE_CACHE_TEXTTURE_DATA
77 VolatileTexture::removeTexture(this);
78 #endif
79
80 CCLOGINFO (“cocos2d: deallocing CCTexture2D %u.”, m_uName);
81 if(m_uName)
82 {
83 glDeleteTextures(1, &m_uName);
84 }
85 }

what’s the problem?

to Minggo Zhang

oh…. Thanks a lot!

I found the problem.
I didn’t override ccTouchBegan method…………… ^^;;;;;;;

thx anyway…