新手求助 this->setTouchEnabled(true) 怎么不能触发了

我在init 中用了:

this->setTouchEnabled(true);

然后我新建一个函数:

void HelloWorld::TouchesEnded(SetpTouches, EventpEvent)
{

CCTouch* touch = (CCTouch*)pTouches->anyObject();//取出一个点
CCPoint locInView = touch->getLocationInView();//得到这个点的位置 UI坐标系的位置点
CCPoint loc = Director::sharedDirector()->convertToGL(locInView);//通过Director将UI坐标系转换成cocos坐标系

}

但是我点击屏幕,根本无法进入到这个函数中呀,我看的是2.2.6的教程~
不过我用的是 3.7的 cocos2d-x~

我c++也是在同步学习中~ 求指导啊~

如何在能实现实现点击触发事件呀~~

touchbegan里返回true了吗?

3.x的触摸处理和2.x不一样了,init里那样写不行吧,要添加一个触摸监听事件,创建个toucheventlistenner,你看看testcpp