MouseMovementTriggerTests UpdatePosition Method Delta Engine Documentation

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

public void UpdatePosition()
Examples

[Test]
public void MoveMouseToUpdatePositionOfCircle()
{
    var ellipse = new Ellipse(new Rectangle(-0.1f, -0.1f, 0.1f, 0.1f), Color.Red);
    new Command(pos => ellipse.Center = pos).Add(new MouseMovementTrigger());
}
[Test, CloseAfterFirstFrame]
public void UpdatePosition()
{
    Vector2D position = Vector2D.Zero;
    new Command(pos => position = pos).Add(new MouseMovementTrigger());
    Assert.AreEqual(Vector2D.Zero, position);
    var mockMouse = Resolve<Mouse>() as MockMouse;
    if (mockMouse == null)
        return; //ncrunch: no coverage
    mockMouse.SetNativePosition(new Vector2D(0.4f, 0.6f));
    AdvanceTimeAndUpdateEntities();
    Assert.AreEqual(new Vector2D(0.4f, 0.6f), position);
}
See Also