Allows mouse button presses to be tracked.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities Entity
DeltaEngine.Commands Trigger
DeltaEngine.Commands InputTrigger
DeltaEngine.Input MouseButtonTrigger
Namespace: DeltaEngine.Input
Assembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The MouseButtonTrigger type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MouseButtonTrigger(Dictionary String, String ) | Initializes a new instance of the MouseButtonTrigger class | |
MouseButtonTrigger(State) | Initializes a new instance of the MouseButtonTrigger class | |
MouseButtonTrigger(MouseButton, State) | Initializes a new instance of the MouseButtonTrigger 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.) | |
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 | |
---|---|---|
Button | ||
IsActive | (Inherited from Entity.) | |
IsPauseable | (Inherited from Trigger.) | |
Movement | ||
NumberOfComponents | (Inherited from Entity.) | |
State | ||
UpdatePriority | (Inherited from Entity.) | |
WasInvokedThisTick | (Inherited from Trigger.) |
Remarks
Examples
[Test] public void PressLeftMouseButtonToCloseWindow() { new FontText(Font.Default, "Press Left Mouse Button to close window", Rectangle.One); new Command(() => Resolve<Window>().CloseAfterFrame()).Add(new MouseButtonTrigger()); }
[Test] public void ClickAndHoldToShowRedEllipseAtMousePosition() { var ellipse = new Ellipse(new Rectangle(-0.1f, -0.1f, 0.1f, 0.1f), Color.Red); new Command(position => ellipse.Center = position).Add(new MouseButtonTrigger(State.Pressed)); }
[Test, CloseAfterFirstFrame] public void Create() { var trigger = new MouseButtonTrigger(MouseButton.Right, State.Pressed); Assert.AreEqual(MouseButton.Right, trigger.Button); Assert.AreEqual(State.Pressed, trigger.State); Assert.AreEqual(MouseButton.Left, new MouseButtonTrigger().Button); Assert.AreEqual(State.Pressing, new MouseButtonTrigger().State); Assert.AreEqual(MouseButton.Left, new MouseButtonTrigger(State.Pressed).Button); Assert.AreEqual(State.Pressed, new MouseButtonTrigger(State.Pressed).State); }
See Also