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


C# Mouse.GetButtonState方法代码示例

本文整理汇总了C#中Mouse.GetButtonState方法的典型用法代码示例。如果您正苦于以下问题:C# Mouse.GetButtonState方法的具体用法?C# Mouse.GetButtonState怎么用?C# Mouse.GetButtonState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mouse的用法示例。


在下文中一共展示了Mouse.GetButtonState方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleWithMouse

		public void HandleWithMouse(Mouse mouse)
		{
			if (StartArea.Contains(mouse.Position) && mouse.GetButtonState(Button) == State.Pressing)
				StartDragPosition = mouse.Position;
			else if (StartDragPosition != Vector2D.Unused &&
				mouse.GetButtonState(Button) != State.Released)
				if (StartDragPosition.DistanceTo(mouse.Position) > PositionEpsilon)
					Invoke();
				else
					StartDragPosition = Vector2D.Unused;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:11,代码来源:MouseDragDropTrigger.cs

示例2: HandleWithMouse

		public void HandleWithMouse(Mouse mouse)
		{
			Position = mouse.Position;
			if (mouse.GetButtonState(Button) == State &&
				ScreenSpace.Current.Viewport.Contains(mouse.Position))
				Invoke();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:MouseButtonTrigger.cs

示例3: HandleWithMouse

		public void HandleWithMouse(Mouse mouse)
		{
			bool wasJustStartedPressing = lastState == State.Pressing;
			State currentState = mouse.GetButtonState(Button);
			var isNowReleased = currentState == State.Releasing;
			lastState = currentState;
			if (isNowReleased && wasJustStartedPressing)
				Invoke();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:MouseTapTrigger.cs

示例4: HandleWithMouse

		public void HandleWithMouse(Mouse mouse)
		{
			if (Position == mouse.Position)
				return;
			var isButton = mouse.GetButtonState(Button) == State;
			Position = mouse.Position;
			if (isButton && ScreenSpace.Current.Viewport.Contains(mouse.Position))
				Invoke();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:9,代码来源:MousePositionTrigger.cs

示例5: HandleWithMouse

		public void HandleWithMouse(Mouse mouse)
		{
			if (mouse.GetButtonState(Button) == State.Pressing)
				StartPosition = mouse.Position;
			Position = mouse.Position;
			if (!CheckHoverState(mouse))
				Elapsed = 0.0f;
			else if (IsHovering())
				Invoke();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:MouseHoldTrigger.cs

示例6: HandleWithMouse

 public void HandleWithMouse(Mouse mouse)
 {
     State currentState = mouse.GetButtonState(Button);
     if ((lastState == State.Pressing || lastState == State.Pressed) &&
         currentState == State.Releasing)
     {
         if (!firstClickDetected)
             firstClickDetected = true;
         else
         {
             if (elapsedAfterFirstClick < 0.2f && ScreenSpace.Current.Viewport.Contains(mouse.Position))
                 Invoke();
             firstClickDetected = false;
         }
     }
     lastState = currentState;
     if (firstClickDetected)
         elapsedAfterFirstClick += Time.Delta;
     else
         elapsedAfterFirstClick = 0f;
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:21,代码来源:MouseDoubleClickTrigger.cs

示例7: CheckHoverState

		private bool CheckHoverState(Mouse mouse)
		{
			return HoldArea.Contains(StartPosition) &&
				mouse.GetButtonState(Button) == State.Pressed &&
				StartPosition.DistanceTo(mouse.Position) < PositionEpsilon;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:6,代码来源:MouseHoldTrigger.cs


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