Tracks any mouse movement, useful to update cursor positions or check hover states.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities Entity
DeltaEngine.Commands Trigger
DeltaEngine.Commands InputTrigger
DeltaEngine.Commands DragTrigger
DeltaEngine.Input MouseMovementTrigger
Namespace: DeltaEngine.Input
Assembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The MouseMovementTrigger type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MouseMovementTrigger | Initializes a new instance of the MouseMovementTrigger class | |
MouseMovementTrigger(Dictionary String, String ) | Initializes a new instance of the MouseMovementTrigger class |
Methods
Name | Description | |
---|---|---|
Add T | (Inherited from Entity.) | |
AddTag | (Inherited from Entity.) | |
ClearTags | (Inherited from Entity.) | |
Contains T | (Inherited from Entity.) | |
ContainsBehavior T | (Inherited from Entity.) | |
ContainsTag | (Inherited from Entity.) | |
Deactivate | (Inherited from Entity.) | |
Dispose | (Inherited from Entity.) | |
Get T |
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D)
View code on GitHub (Inherited from Entity.) | |
GetActiveBehaviors | (Inherited from Entity.) | |
GetComponentsForSaving | (Inherited from Entity.) | |
GetOrDefault T | (Inherited from Entity.) | |
GetTags | (Inherited from Entity.) | |
HandleWithMouse | ||
Invoke | (Inherited from Trigger.) | |
IsDragDirectionCorrect | (Inherited from DragTrigger.) | |
Remove T | (Inherited from Entity.) | |
RemoveTag | (Inherited from Entity.) | |
Set | (Inherited from Entity.) | |
SetComponents | (Inherited from Entity.) | |
Start T | (Inherited from Entity.) | |
StartInputDevice | (Overrides InputTrigger StartInputDevice .) | |
Stop T | (Inherited from Entity.) | |
ToString | (Inherited from Entity.) | |
Update | (Inherited from Trigger.) |
Fields
Name | Description | |
---|---|---|
components | (Inherited from Entity.) | |
Invoked | (Inherited from Trigger.) |
Properties
Name | Description | |
---|---|---|
Direction | (Inherited from DragTrigger.) | |
DoneDragging | (Inherited from DragTrigger.) | |
IsActive | (Inherited from Entity.) | |
IsPauseable | (Inherited from Trigger.) | |
Movement | (Inherited from DragTrigger.) | |
NumberOfComponents | (Inherited from Entity.) | |
StartPosition | (Inherited from DragTrigger.) | |
UpdatePriority | (Inherited from Entity.) | |
WasInvokedThisTick | (Inherited from Trigger.) |
Remarks
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); }
[Test, CloseAfterFirstFrame] public void Create() { var trigger = new MouseMovementTrigger(); Assert.AreEqual(Vector2D.Zero, trigger.Movement); Assert.IsFalse(trigger.IsPauseable); }
See Also