Namespace: DeltaEngine.Commands
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Input.Tests.MouseDragTriggerTests
Tests: DeltaEngine.Input.Tests.MouseMovementTriggerTests
1 unit tests call DeltaEngine.Commands.DragTrigger.Movement
2 unit tests call DeltaEngine.Commands.DragTrigger.Movement
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: Vector2DImplements
MovementTrigger MovementRemarks
Remarks
Examples
[Test] public void DragMouseVertically() { if (!IsMockResolver) return; //ncrunch: no coverage var mouse = (MockMouse)Resolve<Mouse>(); var trigger = new MouseDragTrigger(MouseButton.Left, DragDirection.Vertical); new Command(() => {}).Add(trigger); mouse.SetNativePosition(new Vector2D(0.3f, ScreenSpace.Current.Top + 0.1f)); mouse.SetButtonState(MouseButton.Left, State.Pressing); AdvanceTimeAndUpdateEntities(); mouse.SetNativePosition(new Vector2D(0.3f, ScreenSpace.Current.Bottom - 0.1f)); AdvanceTimeAndUpdateEntities(); Assert.AreEqual(mouse.Position, trigger.Movement); mouse.SetButtonState(MouseButton.Left, State.Releasing); AdvanceTimeAndUpdateEntities(); Assert.IsTrue(trigger.DoneDragging); }
Examples
[Test, CloseAfterFirstFrame] public void Create() { var trigger = new MouseMovementTrigger(); Assert.AreEqual(Vector2D.Zero, trigger.Movement); Assert.IsFalse(trigger.IsPauseable); }
[Test, CloseAfterFirstFrame] public void CreateFromAttributes() { var trigger = new MouseMovementTrigger(new Dictionary<string, string>()); Assert.AreEqual(Vector2D.Zero, trigger.Movement); Assert.Throws<MouseMovementTrigger.MouseMovementTriggerHasNoParameters>( () => new MouseMovementTrigger(new Dictionary<string, string> { { "a", "b" } })); }
See Also