<span style="white-space:pre"> </span>
<span style="white-space:pre"> </span>virtual void registerWithTouchDispatcher(void); virtual void ccTouchesBegan(CCSet *pTouches,CCEvent *pEvent); // 触摸事件中开始时调用的回调函数 virtual void ccTouchesMoved(CCSet *pTouches,CCEvent *pEvent); virtual void ccTouchesEnded(CCSet *pTouches,CCEvent *pEvent); virtual void ccTouchesCancelled(CCSet *pTouches,CCEvent *pEvent);
bool sjt::init() {
<span style="white-space:pre"> // 1. super init first <span style="white-space:pre"> </span>if(!CCLayer::init()) <span style="white-space:pre"> </span>{ <span style="white-space:pre"> </span>return false; <span style="white-space:pre"> </span>}</span>
</pre><pre name="code" class="cpp"><span style="white-space:pre"> // for touch control <span style="white-space:pre"> </span>setTouchEnabled(true); <span style="white-space:pre"> </span>isTouchDown = false;</span>
}
void sjt::registerWithTouchDispatcher() { CCDirector::sharedDirector()->getTouchDispatcher()->addStandardDelegate(this,0); }