cocos2d-x 3.0怎么创建触摸优先级高于Menu
1 回答
白猪掌柜的
TA贡献1893条经验 获得超10个赞
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;
}
- 1 回答
- 0 关注
- 861 浏览
添加回答
举报
0/150
提交
取消