本文整理汇总了C++中CVector2::Distance方法的典型用法代码示例。如果您正苦于以下问题:C++ CVector2::Distance方法的具体用法?C++ CVector2::Distance怎么用?C++ CVector2::Distance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVector2
的用法示例。
在下文中一共展示了CVector2::Distance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleInput
bool CGesturer::HandleInput(CInputEvent* _event)
{
bool recognizedDrag = false;
#ifndef WALO_PLATFORM_WIN
if(_event->InputType == CInputEvent::EIT_TOUCH)
{
CTouchEvent* tevent = (CTouchEvent*)_event;
if(tevent->TouchCount > 1)
{
m_bDragging = false;
CVector2 ptFirstFinger = CVector2(tevent->Touches[0].X, tevent->Touches[0].Y);
CVector2 ptSecondFinger = CVector2(tevent->Touches[1].X, tevent->Touches[1].Y);
f32 zoom = ptSecondFinger.Distance(ptFirstFinger);
f32 roto = CMath::Atan2(ptSecondFinger.Y - ptFirstFinger.Y, ptSecondFinger.X - ptFirstFinger.X);
if(tevent->Touches[0].TouchType == CTouchEvent::ETE_BEGIN || tevent->Touches[1].TouchType == CTouchEvent::ETE_BEGIN)
{
_BeginRotoZoom(roto, zoom);
return true;
}
else
if(tevent->Touches[0].TouchType == CTouchEvent::ETE_MOVE || tevent->Touches[1].TouchType == CTouchEvent::ETE_MOVE)
{
_DoRotoZoom(roto, zoom);
return true;
}
else
{
if(m_bZoomRot)
{
m_bZoomRot = false;
return false;
}
}
}
else
{
m_bZoomRot = false;
if(tevent->Touches[0].TouchType == CTouchEvent::ETE_BEGIN)
{
m_DragStart.X = tevent->Touches[0].X;
m_DragStart.Y = tevent->Touches[0].Y;
m_bDragging = false;
}
else
if(tevent->Touches[0].TouchType == CTouchEvent::ETE_MOVE)
{
if(!m_bDragging)
{
recognizedDrag = _RecognizeDrag(tevent->Touches[0].X, tevent->Touches[0].Y);
if(recognizedDrag)
_BeginDrag(tevent->Touches[0].X, tevent->Touches[0].Y);
}
else
_DoDrag(tevent->Touches[0].X, tevent->Touches[0].Y);
}
else
{
if(!m_bDragging)
{
_HandleTap(tevent->Touches[0].X, tevent->Touches[0].Y);
recognizedDrag = true;
}
m_bDragging = false;
}
return recognizedDrag;
}
}
else
#endif
if(_event->InputType == CInputEvent::EIT_MOUSE)
{
CMouseEvent* mevent = (CMouseEvent*)_event;
if((mevent->Buttons & CMouseEvent::EMBM_LEFT) && !m_MLBPressed)
{
m_DragStart.X = mevent->X;
m_DragStart.Y = mevent->Y;
m_bDragging = false;
m_MLBPressed = true;
}
else
if((mevent->Buttons & CMouseEvent::EMBM_LEFT) && m_MLBPressed)
{
if(!m_bDragging)
{
recognizedDrag = _RecognizeDrag(mevent->X, mevent->Y);
if(recognizedDrag)
_BeginDrag(mevent->X, mevent->Y);
}
else
_DoDrag(mevent->X, mevent->Y);
}
//.........这里部分代码省略.........