cocos2d-x 3.0怎么创建触摸优先级高于Menu

cocos2d-x 3.0怎么创建触摸优先级高于Menu


HUH函数
浏览 862回答 1
1回答

白猪掌柜的

LayerColor *GameStopSprite::createNoTouchLayer(){auto noTouchLayer = LayerColor::create(Color4B(255, 0, 0, 100));auto listener = EventListenerTouchOneByOne::create();listener->setSwallowTouches(true);listener->onTouchBegan = [](Touch *touch, Event *event){log("pressed.......");return false;};Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(listener, -130); //第1句Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, noTouchLayer); //第2句return noTouchLayer;}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Cocos2d-x