fromValue static method

GamepadAxis fromValue(
  1. int value
)

Returns the GamepadAxis for the given native value.

Throws ArgumentError if value does not correspond to a known entry.

Implementation

static GamepadAxis fromValue(int value) => switch (value) {
  0 => GAMEPAD_AXIS_LEFT_X,
  1 => GAMEPAD_AXIS_LEFT_Y,
  2 => GAMEPAD_AXIS_RIGHT_X,
  3 => GAMEPAD_AXIS_RIGHT_Y,
  4 => GAMEPAD_AXIS_LEFT_TRIGGER,
  5 => GAMEPAD_AXIS_RIGHT_TRIGGER,
  _ => throw ArgumentError('Unknown value for $GamepadAxis: $value'),
};