本文整理汇总了C++中TouchEvent::GetPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ TouchEvent::GetPoint方法的具体用法?C++ TouchEvent::GetPoint怎么用?C++ TouchEvent::GetPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TouchEvent
的用法示例。
在下文中一共展示了TouchEvent::GetPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTouchEvent
bool OnTouchEvent( Actor actor, const TouchEvent& event )
{
if( 1u == event.GetPointCount() )
{
const TouchPoint::State state = event.GetPoint(0u).state;
// Clamp to integer values; this is to reduce flicking due to pixel misalignment
const float localPoint = static_cast<float>( static_cast<int>( event.GetPoint( 0 ).local.y ) );
if( TouchPoint::Down == state )
{
mLastPoint = localPoint;
mAnimation = Animation::New( 0.25f );
}
else if( TouchPoint::Motion == state )
{
if( mAnimation )
{
mAnimation.AnimateBy( Property(mTableView, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR );
mAnimation.Play();
mLastPoint = localPoint;
}
}
}
return true;
}
示例2: OnScrollTouched
bool ScrollViewSlideEffect::OnScrollTouched(Actor actor, const TouchEvent& event)
{
// Ignore events with multiple-touch points
if (event.GetPointCount() != 1)
{
return false;
}
if (event.GetPoint(0).state == TouchPoint::Down)
{
const TouchPoint& point = event.GetPoint(0);
Vector3 touchPosition(point.local - Stage::GetCurrent().GetSize() * 0.5f);
Vector3 scrollPosition = GetScrollView().GetCurrentScrollPosition();
GetScrollView().SetProperty(mPropertyReference, scrollPosition + touchPosition + mDelayReferenceOffset);
}
return false;
}