KeyTrigger State Property Delta Engine Documentation

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

public State State { get; }

Property Value

Type: State
Remarks

Tests: DeltaEngine.Input.Tests.KeyTriggerTests
Examples

2 unit tests call DeltaEngine.Input.KeyTrigger.State
[Test, CloseAfterFirstFrame]
public void Create()
{
    var trigger = new KeyTrigger(Key.Z, State.Pressed);
    Assert.AreEqual(Key.Z, trigger.Key);
    Assert.AreEqual(State.Pressed, trigger.State);
}
    [Test, CloseAfterFirstFrame]
    public void CreateFromAttributes()
    {
        var trigger = new KeyTrigger(new Dictionary<string, string>
            {
                { "Key", "Z" },
                { "State", " Pressed" }
            });
        Assert.AreEqual(Key.Z, trigger.Key);
        Assert.AreEqual(State.Pressed, trigger.State);
        Assert.Throws<KeyTrigger.CannotCreateKeyTriggerWithoutKey>(
            () => new KeyTrigger(new Dictionary<string, string>()));
    }

    [Test]
    public void UseMoveDirectlyCommandToMoveCircleAround()
    {
        var circle = new Ellipse(Vector2D.Half, 0.25f, 0.25f, Color.Orange);
        new Command(Command.MoveDirectly, position =>
            circle.DrawArea = circle.DrawArea.Move(position / 24.0f)); //ncrunch: no coverage
    }

    [Test]
    public void ZoomCircleWithPageUpPageDown()
    {
        var circle = new Ellipse(Vector2D.Half, 0.25f, 0.25f, Color.Orange);
        new Command(Command.Zoom, zoom =>
            circle.DrawArea = circle.DrawArea.Increase(new Size(zoom / 24.0f))); //ncrunch: no coverage
    }
}
See Also