Trigger Update Method Delta Engine Documentation

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

public void Update()

Implements

Updateable Update 
Remarks

Tests: DeltaEngine.Input.Tests.TouchPinchTriggerTests
Remarks

Tests: DeltaEngine.Input.Tests.TouchRotateTriggerTests
Remarks

Tests: DeltaEngine.Input.Tests.GamePadAnalogTriggerTests
Remarks

Tests: DeltaEngine.Input.Tests.MouseMovementTriggerTests
Examples

1 unit tests call DeltaEngine.Commands.Trigger.Update
[Test, CloseAfterFirstFrame]
public void PinchDistance()
{
    var trigger = new TouchPinchTrigger();
    var touch = Resolve<Touch>() as MockTouch;
    if (touch == null)
        return; //ncrunch: no coverage
    touch.SetTouchState(0, State.Pressing, new Vector2D(0.4f, 0.5f));
    touch.SetTouchState(1, State.Pressed, new Vector2D(0.5f, 0.5f));
    touch.Update(new[] { trigger });
Examples

1 unit tests call DeltaEngine.Commands.Trigger.Update
[Test, CloseAfterFirstFrame]
public void Angle()
{
    var touch = Resolve<Touch>() as MockTouch;
    if (touch == null)
        return; //ncrunch: no coverage 
    var trigger = new TouchRotateTrigger();
        touch.SetTouchState(0, State.Pressing, new Vector2D(0.5f, 0.1f));
    touch.SetTouchState(1, State.Pressed, new Vector2D(0.5f, 0.7f));
    touch.Update(new[] { trigger });
Examples

1 unit tests call DeltaEngine.Commands.Trigger.Update
[Test]
public void PressingTriggersUpdatesValues()
{
    var font = Font.Default;
    var leftTrigger = new FontText(font, "left", new Rectangle(0.2f, 0.5f, 0.2f, 0.2f));
    var rightTrigger = new FontText(font, "right", new Rectangle(0.7f, 0.5f, 0.2f, 0.2f));
    new Command(pos => leftTrigger.Text = "Left Trigger = " + pos.X).Add(
        new GamePadAnalogTrigger(GamePadAnalog.LeftTrigger));
    new Command(pos => rightTrigger.Text = "Right Trigger = " + pos.X).Add(
        new GamePadAnalogTrigger(GamePadAnalog.RightTrigger));
}
Examples

2 unit tests call DeltaEngine.Commands.Trigger.Update
[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