onTouchBegan()
而不是
onTouchMoved()
和
onTouchEnded()
auto listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = [=](Touch *touch, Event *event) {
CCLOG("on touch begain at (%f,%f)", touch->getLocation().x, touch->getLocation().y);
return false; // this will make following two events couldn't be fired.
};
listener->onTouchMoved = [=](Touch *touch, Event *event) {
CCLOG("on touch moved at (%f, %f)", touch->getLocation().x, touch->getLocation().y);
};
listener->onTouchEnded = [=](Touch *touch, Event * event) {
CCLOG("on touch ended at (%f,%f)", touch->getLocation().x, touch->getLocation().y);
};
_eventDispatcher->addEventListenerWithFixedPriority(listener, 1);
发生这种情况的原因是
onTouchBegan
false
将此更改为后
true
,
onTouchMoved
和
onTouchEnded
我四处搜索,可以找到任何关于这个返回标志打算做什么的解释吗?有人能解释一下吗?