在Cocos2d-x 3.17版本中,getTouchDispatcher()方法已经被移除。取而代之的是使用getEventDispatcher()方法来获取事件派发器。

要解决这个问题,你需要将代码中所有使用getTouchDispatcher()的地方替换为getEventDispatcher()

例如,如果你的代码中有如下的一行代码:

cocos2d::Director::getInstance()->getTouchDispatcher()

你需要将其替换为:

cocos2d::Director::getInstance()->getEventDispatcher()

这样就可以解决这个问题了。请确保在升级Cocos2d-x版本时仔细查看API文档和更新日志,以了解可能的改动和迁移指南。

cocos2dx20升级到cocos2dx 317后No member named getTouchDispatcher in cocos2dDirector

原文地址: https://www.cveoy.top/t/topic/igIJ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录