//! returns true if the button is touched bool Button::IsTouched() const { Matrix44 transformation = Matrix44::Identity; transformation.Translate(-Vector3::Create(m_vCenter.X, m_vCenter.Y, 0.0f)); transformation.Scale(Vector3::Create(m_vScale.X, m_vScale.Y, 1.0f)); transformation.Rotate(Vector3::Create(0.0f, 0.0f, m_fRotation*Math::DegToRadFactor)); transformation.Translate(Vector3::Create(m_vOriginalPosition.X, m_vOriginalPosition.Y, 0.0f)); if(Entity2D* p2DEntity = GetAncestor<Entity2D>()) { transformation *= p2DEntity->GetTransformationMatrix(); } Matrix44 inverse; if(transformation.GetInverse(inverse)) { Vector2 vTouchPos = InputManager::Instance()->GetTouchState().vPosition; Vector3 invTouchPos3D = inverse.TransformVect(Vector3::Create(vTouchPos.X, vTouchPos.Y, 0.0f)); Vector2 vInvTouchPos(invTouchPos3D.X, invTouchPos3D.Y); return GetBoundingBox().Contains(vInvTouchPos); } return false; }