我在代码里面开启的是单点触摸,在ios上面没问题。但是在安卓上面却可以响应多个点,好奇怪啊。求解。代码附上。
auto listener = EventListenerTouchOneByOne::create(); //单点触摸
//2.定义监听对象的回调方法
listener->onTouchBegan = CC_CALLBACK_2(GameRun::onTouchBegan, this);
listener->onTouchMoved = CC_CALLBACK_2(GameRun::onTouchMoved, this);
listener->onTouchEnded = CC_CALLBACK_2(GameRun::onTouchEnded, this);
//3.在事件监听器中注册(事件监听器包含:触摸事件、键盘相应事件、加速记录事件、鼠标响应事件、自定义事件)
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
bool GameRun::onTouchBegan(Touch* touch, Event *event)
{
auto location = touch->getLocation();
m_pMousePos1 = location;
return true;
}