jumpBtn->addTouchEventListener(CC_CALLBACK_2(TollgateScene::jumpEvent, this));
听说改了 可是找%url% 里面的【文档】没看到怎么改的呀

错误如上,求高手高数一下 3.8 这行代码应该怎么改呢?
jumpBtn->addTouchEventListener(CC_CALLBACK_2(TollgateScene::jumpEvent, this));
听说改了 可是找%url% 里面的【文档】没看到怎么改的呀

错误如上,求高手高数一下 3.8 这行代码应该怎么改呢?
addTouchEventListener(this, toucheventselector(TollgateScene::jumpEvent));
↑ 这么写也不行 错误依旧是
错误 1 error C2039: “addTouchEventListener”: 不是“cocos2d::Node”的成员
addTochEventListener(回调函数),这里直接用一个回调函数就行了,不要CC_CALLBACK2这些东西,你参数都放错了
添加事件的对象->addTouchEventListener( CC_CALLBACK(Scene::touchDown),this); 或者 绑定lambda
jumpBtn这个是button还是node?
已知问题所在 错误不在于这句话 在于他的上一句话
Button jumpBtn = ui->getChildByName(“jumpBtn”);
将其修改成
auto jumpBtn = static_castui::Button*(rootNode->getChildByName(“jumpBtn”));
就好使了
一个是 getChildByName 返回的是Node类型的,你那button肯定不对,在一个就算是Button 也是Button指针类型