flame_gamepad 0.0.1 copy "flame_gamepad: ^0.0.1" to clipboard
flame_gamepad: ^0.0.1 copied to clipboard

discontinuedreplaced by: gamepads
outdated

A new flutter plugin project.

flame_gamepad #

Gamepad is only supported on Android at the moment. #

Checking if the gamepad is connected #

    bool isConnected;
    try {
      isConnected = await FlameGamepad.isGamepadConnected;
    } on PlatformException {
      isConnected = false;
    }

Listening to events #

To listen to gamepad events use the 'Flame.gamepad' instance, to add a listener use following snippet.

  var gamepad = FlameGamepad()
    ...addListener((String evtType, String key) {
      print(key)
      if (evtType == GAMEPAD_BUTTON_UP) {
        print('is up')
      } else {
        print('is down')
      }
    });

To check for specific keys use the following constants avaiable flame_gamepad class

GAMEPAD_BUTTON_UP
GAMEPAD_BUTTON_DOWN

GAMEPAD_DPAD_UP
GAMEPAD_DPAD_DOWN
GAMEPAD_DPAD_LEFT
GAMEPAD_DPAD_RIGHT

GAMEPAD_BUTTON_A
GAMEPAD_BUTTON_B
GAMEPAD_BUTTON_X
GAMEPAD_BUTTON_Y

GAMEPAD_BUTTON_L1
GAMEPAD_BUTTON_L2

GAMEPAD_BUTTON_R1
GAMEPAD_BUTTON_R2

GAMEPAD_BUTTON_START
GAMEPAD_BUTTON_SELECT

A functional example can be found here

4
likes
30
pub points
26%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flame_gamepad