GamepadState class

The complete state of a gamepad.

A "normal" value means a value that is linked to two buttons. For example, both triggers contribute to the normalTrigger value, so if the left was pressed less than the right, the "normalized" result would be a small positive value. In general, the normal values range from -1.0 to +1.0, inclusive, with -1 meaning all the way to one side, +1 to the other, and 0 indicates that neither button is pressed.

For digital buttons, a normalized value will only ever be -1, 0, or +1. For analog inputs, including pressure-sensitive triggers, the value will be in the range -1.0, +1.0.

Constructors

GamepadState({required bool buttonA, required bool buttonB, required bool buttonX, required bool buttonY, required bool buttonBack, required bool buttonStart, required double normalTrigger, required double normalShoulder, required double normalLeftX, required double normalLeftY, required double normalRightX, required double normalRightY, required double normalDpadX, required double normalDpadY})
Creates a new representation of the gamepad state.
const

Properties

buttonA → bool
Whether the A button was pressed.
final
buttonB → bool
Whether the B button was pressed.
final
buttonBack → bool
Whether the Back or Select button was pressed.
final
buttonStart → bool
Whether the Start or Options button was pressed.
final
buttonX → bool
Whether the X button was pressed.
final
buttonY → bool
Whether the Y button was pressed.
final
dpadDown → bool
Whether the D-pad's down button is being pressed.
no setter
dpadUp → bool
Whether the D-pad's up button is being pressed.
no setter
hashCode → int
The hash code for this object.
no setterinherited
leftShoulder → bool
Whether the left shoulder is being pressed.
no setter
normalDpadX → double
A normalized reading of the D-pad's X-axis.
final
normalDpadY → double
A normalized reading of the D-pad's X-axis.
final
normalLeftX → double
A normalized reading of the left joystick's X-axis.
final
normalLeftY → double
A normalized reading of the left joystick's Y-axis.
final
normalRightX → double
A normalized reading of the right joystick's X-axis.
final
normalRightY → double
A normalized reading of the right joystick's X-axis.
final
normalShoulder → double
A normalized reading of the shoulder buttons.
final
normalTrigger → double
A normalized reading of the triggers.
final
rightShoulder → bool
Whether the right shoulder is being pressed.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited