1、首先要确定自己使用的触摸事件,有OnTouchBegan等;
2、定义触摸事件方法;
3、注册触摸事件;
auto listener=EventListenerTouchOneByOne::create();
listener->onTouchBegan=CC_CALLBACK_2(HelloWorld::onTouchBegan,this);
_eventDispatcher->addEventListenerWithSceneGraPHPriority(listener,this);
原文链接:https://www.f2er.com/cocos2dx/344978.html