我想点击文本响应事件,按照之前版本写如下代码:
LabelTTF* label = LabelTTF::create("Click to show next","Courier",36); addChild(label); label->setPosition(visibleSize.width / 2, visibleSize.height / 2); auto listenter = EventListenerTouchOneByOne::create(); listenter->onTouchBegan = (Touch* t, Event * e) { if (label->getBoundingBox().containsPoint(t->getLocation())) { // TODO MessageBox("Click Text","Click"); } return false; }; Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listenter, label); ``` 但是if判断一直没有进去,函数是成功执行的,求高手指教,万分感谢!!