Namespace: DeltaEngine.Commands
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Input.Tests.TouchPinchTriggerTests
Tests: DeltaEngine.Input.Tests.TouchRotateTriggerTests
Tests: DeltaEngine.Input.Tests.GamePadAnalogTriggerTests
Tests: DeltaEngine.Input.Tests.MouseMovementTriggerTests
1 unit tests call DeltaEngine.Commands.Trigger.Update
1 unit tests call DeltaEngine.Commands.Trigger.Update
1 unit tests call DeltaEngine.Commands.Trigger.Update
2 unit tests call DeltaEngine.Commands.Trigger.Update
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Implements
Updateable UpdateRemarks
Remarks
Remarks
Remarks
Examples
[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
[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
[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
[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