cocos2d-x3.2触屏问题,不会调用onTouchBegan

3.2版本改了触摸机制,加如下代码即可


auto listener = EventListenerTouchOneByOne::create();
listener->setSwallowTouches(true);
listener->onTouchBegan = CC_CALLBACK_2(PlayGameLayer::onTouchBegan, this);
listener->onTouchMoved = CC_CALLBACK_2(PlayGameLayer::onTouchMoved, this);
listener->onTouchEnded = CC_CALLBACK_2(PlayGameLayer::onTouchEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);

你可能感兴趣的:(Cocos2d-x3.2)