当前位置: 首页>>代码示例>>C#>>正文


C# Touch.GetState方法代码示例

本文整理汇总了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;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:TouchDualDragTrigger.cs

示例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();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:TouchDragTrigger.cs

示例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;
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:10,代码来源:TouchDragDropTrigger.cs

示例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;
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:10,代码来源:TouchPinchTrigger.cs

示例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();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:11,代码来源:TouchDualDragTrigger.cs

示例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;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:12,代码来源:TouchPinchTrigger.cs

示例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;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:14,代码来源:TouchRotateTrigger.cs

示例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);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:14,代码来源:TouchFlickTrigger.cs

示例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();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:15,代码来源:TouchDualDragTrigger.cs

示例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();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:TouchPositionTrigger.cs

示例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();
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:9,代码来源:TouchTapTrigger.cs

示例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();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:TouchDragTrigger.cs

示例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;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:21,代码来源:TouchDoubleTapTrigger.cs

示例14: HandleWithTouch

		public void HandleWithTouch(Touch touch)
		{
			if (touch.GetState(0) == State)
				Invoke();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:5,代码来源:TouchPressTrigger.cs


注:本文中的Touch.GetState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。