本文整理汇总了C#中Touch.GetState方法的典型用法代码示例。如果您正苦于以下问题:C# Touch.GetState方法的具体用法?C# Touch.GetState怎么用?C# Touch.GetState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Touch
的用法示例。
在下文中一共展示了Touch.GetState方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsDualDragActive
private bool IsDualDragActive(Touch touch)
{
bool isFirstTouchActive = StartPosition != Vector2D.Unused &&
touch.GetState(0) != State.Released;
bool isSecondTouchActive = SecondStartPosition != Vector2D.Unused &&
touch.GetState(0) != State.Released;
return isFirstTouchActive && isSecondTouchActive;
}
示例2: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
if (touch.GetState(0) == State.Pressing)
StartPosition = touch.GetPosition(0);
else if (StartPosition != Vector2D.Unused && touch.GetState(0) != State.Released)
UpdateWhileDragging(touch);
else
Reset();
}
示例3: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
var position = touch.GetPosition(0);
if (StartArea.Contains(position) && touch.GetState(0) == State.Pressing)
StartDragPosition = position;
else if (StartDragPosition != Vector2D.Unused && touch.GetState(0) != State.Released)
InvokeIfMovedFarEnough(position);
else
StartDragPosition = Vector2D.Unused;
}
示例4: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
if (touch.GetState(0) >= State.Pressing && touch.GetState(1) >= State.Pressing)
{
Distance = Math.Abs((touch.GetPosition(1) - touch.GetPosition(0)).Length);
Invoke();
}
else
Distance = 0f;
}
示例5: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
if (touch.GetState(0) == State.Pressing)
StartPosition = touch.GetPosition(0);
if (touch.GetState(1) == State.Pressing)
SecondStartPosition = touch.GetPosition(1);
if (IsDualDragActive(touch))
HandleOnActive(touch);
else
Reset();
}
示例6: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
var direction = touch.GetPosition(0).DirectionTo(touch.GetPosition(1));
if (touch.GetState(0) >= State.Pressing && touch.GetState(1) >= State.Pressing)
{
ZoomAmount = direction.Length - lastDistance;
Invoke();
}
else
ZoomAmount = 0f;
lastDistance = direction.Length;
}
示例7: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
if (touch.GetState(0) >= State.Pressing && touch.GetState(1) >= State.Pressing)
{
var vector = (touch.GetPosition(1) - touch.GetPosition(0));
vector = vector / vector.Length;
Angle = (float)Math.Atan2(vector.X, vector.Y);
if (Angle < 0)
Angle += (float)(2 * Math.PI);
Invoke();
}
else
Angle = 0f;
}
示例8: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
if (touch.GetState(0) == State.Pressing)
SetFlickPositionAndResetTime(touch.GetPosition(0));
else if (StartPosition != Vector2D.Unused && touch.GetState(0) != State.Released)
{
PressTime += Time.Delta;
if (touch.GetState(0) == State.Releasing &&
StartPosition.DistanceTo(touch.GetPosition(0)) > PositionEpsilon && PressTime < 0.3f)
Invoke();
}
else
SetFlickPositionAndResetTime(Vector2D.Unused);
}
示例9: HandleOnActive
private void HandleOnActive(Touch touch)
{
var movementDirection = StartPosition.DirectionTo(touch.GetPosition(0));
var secondMovementDirection = SecondStartPosition.DirectionTo(touch.GetPosition(1));
if (IsMovementWithinEpsilon(movementDirection, secondMovementDirection))
return;
if (IsDragDirectionCorrect(movementDirection) &&
IsDragDirectionCorrect(secondMovementDirection))
{
Position = touch.GetPosition(0);
SecondPosition = touch.GetPosition(1);
DoneDragging = touch.GetState(0) <= State.Releasing && touch.GetState(1) <= State.Releasing;
}
Invoke();
}
示例10: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
var isButton = touch.GetState(0) == State;
bool changedPosition = Position != touch.GetPosition(0);
Position = touch.GetPosition(0);
if (isButton && changedPosition && ScreenSpace.Current.Viewport.Contains(Position))
Invoke();
}
示例11: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
bool wasJustStartedPressing = lastState == State.Pressing;
State currentState = touch.GetState(0);
var isNowReleased = currentState == State.Releasing;
lastState = currentState;
if (isNowReleased && wasJustStartedPressing)
Invoke();
}
示例12: UpdateWhileDragging
private void UpdateWhileDragging(Touch touch)
{
var movementDirection = StartPosition.DirectionTo(touch.GetPosition(0));
if (movementDirection.Length <= PositionEpsilon)
return;
Position = touch.GetPosition(0);
if (IsDragDirectionCorrect(movementDirection))
DoneDragging = touch.GetState(0) == State.Releasing;
Invoke();
}
示例13: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
State currentState = touch.GetState(0);
if ((lastState == State.Pressing || lastState == State.Pressed) &&
currentState == State.Releasing)
{
if (!firstTapDetected)
firstTapDetected = true;
else
{
if (elapsedAfterFirstTap < 0.2f)
Invoke();
firstTapDetected = false;
}
}
lastState = currentState;
if (firstTapDetected)
elapsedAfterFirstTap += Time.Delta;
else
elapsedAfterFirstTap = 0f;
}
示例14: HandleWithTouch
public void HandleWithTouch(Touch touch)
{
if (touch.GetState(0) == State)
Invoke();
}