本文整理汇总了C++中TouchList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ TouchList::begin方法的具体用法?C++ TouchList::begin怎么用?C++ TouchList::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TouchList
的用法示例。
在下文中一共展示了TouchList::begin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MouseUpEvent
void MobileSimulator::MouseUpEvent(Vec2i screenCoordinates, MouseButtonInput button)
{
_multiGestureOngoing = false;
_gestureType = NONE;
_mouseDown = false;
TouchList* tl = &TouchListener::GetTouchList();
if (theInput.IsKeyDown(ANGEL_KEY_LEFTCONTROL) || theInput.IsKeyDown(ANGEL_KEY_RIGHTCONTROL))
{
TouchList::iterator it = tl->begin();
while (it != tl->end())
{
SendTouchNotifiers((*it), TOUCH_END);
delete (*it);
it = tl->erase(it);
}
}
else
{
// just a single touch, but we'll iterate anyway
TouchList::iterator it = tl->begin();
while (it != tl->end())
{
if ( (theWorld.GetCurrentTimeSeconds() - (*it)->MotionStartTime) < SWIPE_MAX_DURATION)
{
Vector2 start((*it)->StartingPoint.X, (*it)->StartingPoint.Y);
Vector2 end((*it)->CurrentPoint.X, (*it)->CurrentPoint.Y);
Vector2 motion = end - start;
if (motion.LengthSquared() >= (SWIPE_MIN_DISTANCE * SWIPE_MIN_DISTANCE))
{
float angle = MathUtil::ToDegrees(acos(Vector2::Dot(Vector2::UnitX, Vector2::Normalize(motion))));
if (motion.Y > 0.0f)
{
angle = 360.0f - angle;
}
if ( (angle > 45.0f) && (angle <= 135.0f) )
{
// swipe up
theSwitchboard.Broadcast(new Message("MultiTouchSwipeUp"));
}
else if ( (angle > 135.0f) && (angle <= 225.0f) )
{
// swipe left
theSwitchboard.Broadcast(new Message("MultiTouchSwipeLeft"));
}
else if ( (angle > 225.0f) && (angle <= 315.0f) )
{
// swipe down
theSwitchboard.Broadcast(new Message("MultiTouchSwipeDown"));
}
else
{
// swipe right
theSwitchboard.Broadcast(new Message("MultiTouchSwipeRight"));
}
}
}
SendTouchNotifiers((*it), TOUCH_END);
delete (*it);
it = tl->erase(it);
}
}
}