Mouse ClassDelta Engine Documentation
Provides the mouse position, mouse button states and allows to set the mouse position. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Entities UpdateBehavior
    DeltaEngine.Input InputDevice
      DeltaEngine.Input Mouse
        DeltaEngine.Input.GLFW2 GLFWMouse
        DeltaEngine.Input.GLFW3 GLFWMouse
        DeltaEngine.Input.Mocks MockMouse
        DeltaEngine.Input.SharpDX SharpDXMouse
        DeltaEngine.Input.SlimDX SlimDXMouse
        DeltaEngine.Input.Windows WindowsMouse
        DeltaEngine.Input.Xna XnaMouse

Namespace: DeltaEngine.Input
Assembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public abstract class Mouse : InputDevice

The Mouse type exposes the following members.

Constructors

  NameDescription
Protected methodMouse
Initializes a new instance of the Mouse class
Top
Methods

  NameDescription
Public methodDispose (Inherited from InputDevice.)
Public methodGetButtonState
Public methodSetNativePosition
Public methodUpdate (Overrides UpdateBehavior Update(IEnumerable Entity ).)
Top
Properties

  NameDescription
Public propertyIsAvailable (Inherited from InputDevice.)
Public propertyLeftButton
Public propertyMiddleButton
Public propertyPosition
Public propertyRightButton
Public propertyScrollWheelValue
Total accumulated mouse scroll wheel value. Compare with last frame to see the change (see MouseZoomTrigger). Will not use multipliers like 120 to report one mouse wheel up change. One mouse wheel up change results in a value change of +1, down is -1. View code on GitHub
Public propertyX1Button
Public propertyX2Button
Top
Remarks

Tests: DeltaEngine.Input.Tests.MouseButtonTriggerTests
Examples

58 unit tests call DeltaEngine.Input.Mouse
[Test]
public void PressLeftMouseButtonToCloseWindow()
{
    new FontText(Font.Default, "Press Left Mouse Button to close window", Rectangle.One);
    new Command(() => Resolve<Window>().CloseAfterFrame()).Add(new MouseButtonTrigger());
}
[Test]
public void ClickAndHoldToShowRedEllipseAtMousePosition()
{
    var ellipse = new Ellipse(new Rectangle(-0.1f, -0.1f, 0.1f, 0.1f), Color.Red);
    new Command(position => ellipse.Center = position).Add(new MouseButtonTrigger(State.Pressed));
}
[Test, CloseAfterFirstFrame]
public void Create()
{
    var trigger = new MouseButtonTrigger(MouseButton.Right, State.Pressed);
    Assert.AreEqual(MouseButton.Right, trigger.Button);
    Assert.AreEqual(State.Pressed, trigger.State);
    Assert.AreEqual(MouseButton.Left, new MouseButtonTrigger().Button);
    Assert.AreEqual(State.Pressing, new MouseButtonTrigger().State);
    Assert.AreEqual(MouseButton.Left, new MouseButtonTrigger(State.Pressed).Button);
    Assert.AreEqual(State.Pressed, new MouseButtonTrigger(State.Pressed).State);
}
See Also