本文整理汇总了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;
}
示例2: HandleWithMouse
public void HandleWithMouse(Mouse mouse)
{
Position = mouse.Position;
if (mouse.GetButtonState(Button) == State &&
ScreenSpace.Current.Viewport.Contains(mouse.Position))
Invoke();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例7: CheckHoverState
private bool CheckHoverState(Mouse mouse)
{
return HoldArea.Contains(StartPosition) &&
mouse.GetButtonState(Button) == State.Pressed &&
StartPosition.DistanceTo(mouse.Position) < PositionEpsilon;
}