Cocos2dx 3.1.1 半透明的Layer中如何实现屏蔽后面层的事件(屏蔽层)(不用CocoStudio的json文件)?

this->setTouchEnabled(true);this->setTouchPriority(-129);this->setTouchMode(kCCTouche... this->setTouchEnabled(true);
this->setTouchPriority(-129);
this->setTouchMode(kCCTouchesOneByOne);
this->registerWithTouchDispatcher();
这几个方法在3.1.1的引擎中已经不起作用了。请问怎么实现屏蔽?
展开
 我来答
淡淡风淡淡
2014-11-19 · 超过11用户采纳过TA的回答
知道答主
回答量:47
采纳率:0%
帮助的人:25.6万
展开全部
现在使用这个方法:
EventListenerTouchOneByOne* listener = EventListenerTouchOneByOne::create();

listener->setSwallowTouches(true);

listener->onTouchBegan = CC_CALLBACK_2(MatchScene::onTouchBegan,this);
listener->onTouchMoved = CC_CALLBACK_2(MatchScene::onTouchMoved,this);
listener->onTouchEnded = CC_CALLBACK_2(MatchScene::onTouchEnded,this);

_eventDispatcher->addEventListenerWithSceneGraphPriority(listener,this);
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式