void TouchManager::mouseTouchBegin(const ci::app::MouseEvent &event, int id){ ci::Vec2f globalPos = translateMousePoint(event.getPos()); if(shouldDiscardTouch(globalPos)){ return; } inputBegin(id, globalPos); }
void TouchManager::mouseTouchMoved(const MouseEvent &event, int id ){ TouchInfo touchInfo; touchInfo.mCurrentGlobalPoint = Vec3f(translateMousePoint(event.getPos()), 0.0f); touchInfo.mFingerId = id; touchInfo.mStartPoint = mTouchStartPoint[touchInfo.mFingerId]; touchInfo.mDeltaPoint = touchInfo.mCurrentGlobalPoint - mTouchPreviousPoint[touchInfo.mFingerId]; touchInfo.mPhase = TouchInfo::Moved; touchInfo.mPassedTouch = false; touchInfo.mPickedSprite = mFingerDispatcher[touchInfo.mFingerId]; if(mCapture) mCapture->touchMoved(touchInfo); mRotationTranslator.move(touchInfo, mTouchPreviousPoint[touchInfo.mFingerId]); if (mFingerDispatcher[touchInfo.mFingerId]) { mFingerDispatcher[touchInfo.mFingerId]->processTouchInfo( touchInfo ); } mTouchPreviousPoint[touchInfo.mFingerId] = touchInfo.mCurrentGlobalPoint; }
void TouchManager::mouseTouchBegin(const MouseEvent &event, int id ){ TouchInfo touchInfo; touchInfo.mCurrentGlobalPoint = Vec3f(translateMousePoint(event.getPos()), 0.0f); touchInfo.mFingerId = id; touchInfo.mStartPoint = mTouchStartPoint[touchInfo.mFingerId] = touchInfo.mCurrentGlobalPoint; mTouchPreviousPoint[touchInfo.mFingerId] = touchInfo.mCurrentGlobalPoint; touchInfo.mDeltaPoint = touchInfo.mCurrentGlobalPoint - mTouchPreviousPoint[touchInfo.mFingerId]; touchInfo.mPhase = TouchInfo::Added; touchInfo.mPassedTouch = false; if (mCapture) mCapture->touchBegin(touchInfo); Sprite *currentSprite = getHit(touchInfo.mCurrentGlobalPoint); touchInfo.mPickedSprite = currentSprite; mRotationTranslator.down(touchInfo); if ( currentSprite ) { mFingerDispatcher[touchInfo.mFingerId] = currentSprite; currentSprite->processTouchInfo(touchInfo); } }
void TouchManager::mouseTouchEnded(const ci::app::MouseEvent &event, int id){ ci::Vec2f globalPos = translateMousePoint(event.getPos()); inputEnded(id, globalPos); }