xinput_gamepad 1.2.0 copy "xinput_gamepad: ^1.2.0" to clipboard
xinput_gamepad: ^1.2.0 copied to clipboard

outdated

Add support to XInput controllers.

xinput_gamepad #

Add support to XInput controllers with Win32 API. #

badge_version badge_license badge_sdk badge_platform

Dependencies #

Features #

  • Handle controller inputs easily;
  • Get controllers information (Battery type, battery level, controller type and more);
  • Get connected controllers;
  • Set more than one button mapping per controller;
  • Set input lag and controller's deadzone;
  • Set and use controller's vibration motor;

Instalation #

With Dart

dart pub add xinput_gamepad

With Flutter

flutter pub add xinput_gamepad

See more in install section

Simple example #

Enable XInput:

XInputManager.enableXInput();

Init and map the controller:

final Controller controller = Controller(index: 0);
controller.buttonsMapping = {
  ControllerButton.A_BUTTON: () =>
      print("Controller $controllerIndex - Button A"),
  ControllerButton.B_BUTTON: () =>
      print("Controller $controllerIndex - Button B"),
  ControllerButton.X_BUTTON: () =>
      print("Controller $controllerIndex - Button X"),
  ControllerButton.Y_BUTTON: () =>
      print("Controller $controllerIndex - Button Y"),
};

//Start to listen inputs
controller.lister();

You can get the indexes of the available/connected controllers with:

ControllersManager.getIndexConnectedControllers();

See all practical examples here

Documentation #

Access the documentation here

3
likes
0
pub points
63%
popularity

Publisher

unverified uploader

Add support to XInput controllers.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

ffi, win32

More

Packages that depend on xinput_gamepad