Trigger implementation for Thumb Sticks and Triggers on controllers.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Entities Entity
DeltaEngine.Commands Trigger
DeltaEngine.Commands InputTrigger
DeltaEngine.Input GamePadAnalogTrigger
Namespace: DeltaEngine.Input
Assembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The GamePadAnalogTrigger type exposes the following members.
Constructors
Name | Description | |
---|---|---|
GamePadAnalogTrigger(Dictionary String, String ) | Initializes a new instance of the GamePadAnalogTrigger class | |
GamePadAnalogTrigger(GamePadAnalog) | Initializes a new instance of the GamePadAnalogTrigger 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.) | |
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 | |
---|---|---|
GamePadNumber | ||
IsActive | (Inherited from Entity.) | |
IsPauseable | (Inherited from Trigger.) | |
Movement | ||
NumberOfComponents | (Inherited from Entity.) | |
Stick | ||
UpdatePriority | (Inherited from Entity.) | |
WasInvokedThisTick | (Inherited from Trigger.) |
Remarks
Examples
[Test] public void MovingSticksTranslatesCircle() { var ellipseLeft = new Ellipse(new Rectangle(0.4f, 0.5f, 0.1f, 0.1f), Color.Green); var ellipseRight = new Ellipse(new Rectangle(0.6f, 0.5f, 0.1f, 0.1f), Color.Blue); new Command(pos => ellipseLeft.Center = pos * 0.2f + Vector2D.Half).Add( new GamePadAnalogTrigger(GamePadAnalog.LeftThumbStick)); new Command(pos => ellipseRight.Center = pos * 0.2f + Vector2D.Half).Add( new GamePadAnalogTrigger(GamePadAnalog.RightThumbStick)); }
[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)); }
[Test, CloseAfterFirstFrame] public void Create() { var trigger = new GamePadAnalogTrigger(GamePadAnalog.RightThumbStick); Assert.AreEqual(GamePadAnalog.RightThumbStick, trigger.Stick); Assert.AreEqual(Vector2D.Zero, trigger.Movement); }
See Also