auto director = CCDirector::sharedDirector(); auto touchDispatcher = director->getTouchDispatcher(); touchDispatcher->addTargetedDelegate(this, kCCMenuHandlerPriority, true);
auto director = CCDirector::sharedDirector(); auto touchDispatcher = director->getTouchDispatcher(); touchDispatcher->removeDelegate(this);
auto director = CCDirector::sharedDirector(); auto touchDispatcher = director->getTouchDispatcher(); touchDispatcher->setPriority(kCCMenuHandlerPriority - 1, this);This code example sets the priority of the current class instance to be one less than the highest priority for handling touch events. These code examples demonstrate basic usage of CCDirector's getTouchDispatcher() function and are included in the "cocos2d" package library.