bool UIInputManager::onTouchCanceled(float x,float y) { this->m_bTouchDown = false; CocoWidget* hitWidget = this->m_pCurSelectedWidget; if (!hitWidget || !hitWidget->getActive()){ return false; } this->touchEndedPoint.x = x; this->touchEndedPoint.y = y; hitWidget->onTouchReleased(this->touchEndedPoint); this->m_pCurSelectedWidget = NULL; hitWidget = NULL; return true; }
bool UIInputManager::onTouchPressed(float x,float y) { this->touchBeganedPoint.x = x; this->touchBeganedPoint.y = y; CocoWidget* hitWidget = this->checkEventWidget(this->touchBeganedPoint); if (!hitWidget || !hitWidget->getActive()){ this->m_pCurSelectedWidget = NULL; return false; } this->m_pCurSelectedWidget = hitWidget; hitWidget->onTouchPressed(this->touchBeganedPoint); this->m_bTouchDown = true; return true; }
bool UIInputManager::onTouchCanceled(cocos2d::CCTouch* touch) { this->m_bTouchDown = false; CocoWidget* hitWidget = this->m_pCurSelectedWidget; if (!hitWidget || !hitWidget->getActive()){ return false; } this->touchEndedPoint.x = touch->getLocation().x; this->touchEndedPoint.y = touch->getLocation().y; hitWidget->onTouchReleased(this->touchEndedPoint); this->m_pCurSelectedWidget = NULL; hitWidget = NULL; return true; }
bool UIInputManager::onTouchPressed(cocos2d::CCTouch* touch) { this->touchBeganedPoint.x = touch->getLocation().x; this->touchBeganedPoint.y = touch->getLocation().y; CocoWidget* hitWidget = this->checkEventWidget(this->touchBeganedPoint); if (!hitWidget || !hitWidget->getActive()){ this->m_pCurSelectedWidget = NULL; return false; } this->m_pCurSelectedWidget = hitWidget; hitWidget->onTouchPressed(this->touchBeganedPoint); this->m_bTouchDown = true; return true; }
bool UIInputManager::onTouchMoved(float x,float y) { CocoWidget* hitWidget = this->m_pCurSelectedWidget; if (!hitWidget || !hitWidget->getActive()){ return false; } this->touchMovedPoint.x = x; this->touchMovedPoint.y = y; hitWidget->onTouchMoved(this->touchMovedPoint); if (this->m_bTouchDown){ this->m_fLongClickRecordTime = 0; this->m_bTouchDown = false; } return true; }
bool UIInputManager::onTouchMoved(cocos2d::CCTouch* touch) { CocoWidget* hitWidget = this->m_pCurSelectedWidget; if (!hitWidget || !hitWidget->getActive()){ return false; } this->touchMovedPoint.x = touch->getLocation().x; this->touchMovedPoint.y = touch->getLocation().y; hitWidget->onTouchMoved(this->touchMovedPoint); if (this->m_bTouchDown){ this->m_fLongClickRecordTime = 0; this->m_bTouchDown = false; } return true; }