GamePad ClassDelta Engine Documentation
Provides a way to fetch the current game pad input values. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Entities UpdateBehavior
    DeltaEngine.Input InputDevice
      DeltaEngine.Input GamePad
        DeltaEngine.Input.GLFW2 GLFWGamePad
        DeltaEngine.Input.GLFW3 GLFWGamePad
        DeltaEngine.Input.Mocks MockGamePad
        DeltaEngine.Input.SharpDX SharpDXGamePad
        DeltaEngine.Input.SlimDX SlimDXGamePad
        DeltaEngine.Input.Windows WindowsGamePad
        DeltaEngine.Input.Xna XnaGamePad

Namespace: DeltaEngine.Input
Assembly: DeltaEngine.Input (in DeltaEngine.Input.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public abstract class GamePad : InputDevice

The GamePad type exposes the following members.

Constructors

  NameDescription
Protected methodGamePad
Initializes a new instance of the GamePad class
Top
Methods

  NameDescription
Public methodDispose (Inherited from InputDevice.)
Public methodGetButtonState
Public methodGetLeftThumbStick
Public methodGetLeftTrigger
Public methodGetRightThumbStick
Public methodGetRightTrigger
Public methodUpdate (Overrides UpdateBehavior Update(IEnumerable Entity ).)
Protected methodUpdateGamePadStates
Public methodVibrate
Top
Properties

  NameDescription
Public propertyIsAvailable (Inherited from InputDevice.)
Protected propertyNumber
Top
Remarks

Tests: DeltaEngine.Input.Tests.GamePadAnalogTriggerTests
Examples

11 unit tests call DeltaEngine.Input.GamePad
[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