CC_DEPRECATED_ATTRIBUTE void setTouchEnabled(bool value);
alpha 0 里还可以用 现在弃用了
替换方法是哪个啊?``````
CC_DEPRECATED_ATTRIBUTE void setTouchEnabled(bool value);
alpha 0 里还可以用 现在弃用了
替换方法是哪个啊?``````
现在一般都在你重写的类里这样写:
auto touchListener = EventListenerTouchOneByOne::create();
touchListener->setSwallowTouches(true);
touchListener->onTouchBegan = CC_CALLBACK_2(MyMenu::onTouchBegan, this);
touchListener->onTouchMoved = CC_CALLBACK_2(MyMenu::onTouchMoved, this);
touchListener->onTouchEnded = CC_CALLBACK_2(MyMenu::onTouchEnded, this);
touchListener->onTouchCancelled = CC_CALLBACK_2(MyMenu::onTouchCancelled, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
这里的MyMenu是我重写的menu
假如我场景切换,怎么移除侦听器,是系统自动移除吗?
不是 应该有一个类似_eventDispatcher->removeEventListener();的方法,你去头文件里找一下。