GamepadState class

The complete state of a gamepad.

A "normal" value means a value that is linked to two directions. For example, both triggers contribute to the normalTriggers 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 between -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 bool leftJoystickButton, required bool rightJoystickButton, required int leftJoystickX, required int leftJoystickY, required int rightJoystickX, required int rightJoystickY, required int leftTrigger, required int rightTrigger, required bool dpadUp, required bool dpadDown, required bool dpadLeft, required bool dpadRight, required bool leftShoulder, required bool rightShoulder})
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 down button on the directional arrow pad is pressed.
final
dpadLeft bool
Whether the left button on the directional arrow pad is pressed.
final
dpadRight bool
Whether the right button on the directional arrow pad is pressed.
final
dpadUp bool
Whether the up button on the directional arrow pad is pressed.
final
hashCode int
The hash code for this object.
no setterinherited
leftJoystickButton bool
Whether the left joystick is being pressed in.
final
leftJoystickX int
The raw value of the left joystick's X axis.
final
leftJoystickY int
The raw value of the left joystick's Y axis.
final
leftShoulder bool
Whether the left shoulder is pressed.
final
leftTrigger int
The raw value of the left trigger.
final
normalDpadX int
A normalized reading of the D-pad's X-axis that is between -1.0 and +1.0.
no setter
normalDpadY int
A normalized reading of the D-pad's Y-axis that is between -1.0 and +1.0.
no setter
normalLeftJoystickX double
A normalized reading of leftJoystickX that is between -1.0 and +1.0.
no setter
normalLeftJoystickY double
A normalized reading of leftJoystickY that is between -1.0 and +1.0.
no setter
normalLeftTrigger double
A normalized version of leftTrigger that is between 0.0 and 1.0.
no setter
normalRightJoystickX double
A normalized reading of rightJoystickY that is between -1.0 and +1.0.
no setter
normalRightJoystickY double
A normalized reading of leftJoystickY that is between -1.0 and +1.0.
no setter
normalRightTrigger double
A normalized version of rightTrigger that is between 0.0 and 1.0.
no setter
normalShoulders int
A normalized reading of the shoulders that is between -1.0 and +1.0.
no setter
normalTriggers double
A normalized reading of the triggers that is between -1.0 and +1.0.
no setter
rightJoystickButton bool
Whether the right joystick is being pressed in.
final
rightJoystickX int
The raw value of the right joystick's X axis.
final
rightJoystickY int
The raw value of the left joystick's Y axis.
final
rightShoulder bool
Whether the right shoulder is pressed.
final
rightTrigger int
The raw value of the left trigger.
final
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