cocos2d-x3.x屏蔽遮罩层屏蔽触摸button
cocos2d-x3.x触摸方法改变后,。屏蔽掉的层实际上触摸事件的非常easy,首先touchbegan一定要回true,第二,该事件被设定为听吞没触摸true。最近登录触摸水平必须低于0,现在,我们不能设置为水平0该。记
转载请注明地址:白白http://blog.csdn.net/u010229677
<span style="font-size:18px;">auto touchListener=EventListenerTouchOneByOne::create(); touchListener->onTouchBegan=[=](Touch *touch,Event *event) { touchListener->setSwallowTouches(true); return true; }; _eventDispatcher->addEventListenerWithFixedPriority(touchListener,-5); //也能够把-5换成this</span>
或者这么写,事实上都是一个道理
<span style="font-size:18px;"> auto callBack = [](Touch*, Event*) { return true; }; EventListenerTouchOneByOne* listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = callBack; listener->setSwallowTouches(true); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener,this);</span>
版权声明:本文博客原创文章。博客,未经同意,不得转载。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步