GamePadAnalogTrigger ClassDelta Engine Documentation
Trigger implementation for Thumb Sticks and Triggers on controllers. View code on GitHub
Inheritance Hierarchy

System Object
  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

public class GamePadAnalogTrigger : InputTrigger, 
	MovementTrigger

The GamePadAnalogTrigger type exposes the following members.

Constructors

  NameDescription
Public methodGamePadAnalogTrigger(Dictionary String, String )
Initializes a new instance of the GamePadAnalogTrigger class
Public methodGamePadAnalogTrigger(GamePadAnalog)
Initializes a new instance of the GamePadAnalogTrigger class
Top
Methods

  NameDescription
Public methodAdd T  (Inherited from Entity.)
Public methodAddTag (Inherited from Entity.)
Public methodClearTags (Inherited from Entity.)
Public methodContains T  (Inherited from Entity.)
Public methodContainsBehavior T  (Inherited from Entity.)
Public methodContainsTag (Inherited from Entity.)
Protected methodDeactivate (Inherited from Entity.)
Public methodDispose (Inherited from Entity.)
Public methodGet T 
Gets a specific component, derived classes can return faster cached values (e.g. Entity2D) View code on GitHub
(Inherited from Entity.)
Protected methodGetActiveBehaviors (Inherited from Entity.)
Protected methodGetComponentsForSaving (Inherited from Entity.)
Public methodGetOrDefault T  (Inherited from Entity.)
Public methodGetTags (Inherited from Entity.)
Public methodInvoke (Inherited from Trigger.)
Public methodRemove T  (Inherited from Entity.)
Public methodRemoveTag (Inherited from Entity.)
Public methodSet (Inherited from Entity.)
Public methodSetComponents (Inherited from Entity.)
Public methodStart T  (Inherited from Entity.)
Protected methodStartInputDevice (Overrides InputTrigger StartInputDevice .)
Public methodStop T  (Inherited from Entity.)
Public methodToString (Inherited from Entity.)
Public methodUpdate (Inherited from Trigger.)
Top
Fields

  NameDescription
Protected fieldcomponents (Inherited from Entity.)
Public fieldInvoked (Inherited from Trigger.)
Top
Properties

  NameDescription
Public propertyGamePadNumber
Public propertyIsActive (Inherited from Entity.)
Public propertyIsPauseable (Inherited from Trigger.)
Public propertyMovement
Public propertyNumberOfComponents (Inherited from Entity.)
Public propertyStick
Public propertyUpdatePriority (Inherited from Entity.)
Public propertyWasInvokedThisTick (Inherited from Trigger.)
Top
Remarks

Tests: DeltaEngine.Input.Tests.GamePadAnalogTriggerTests
Examples

4 unit tests call DeltaEngine.Input.GamePadAnalogTrigger
[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