Skip to content
ROG edited this page Jul 25, 2022 · 4 revisions

Welcome to the xinput_gamepad wiki!

xinput_gamepad is a package that handle a XInput controller inputs with FFI calls to Win32 API.

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 the examples:

Name Description
console Get controller inputs and show what button is pressed.
flutter_windwos Shows what button is pressed in each connected controller and the thumbs and triggers variation.

Wiki Sections

  1. Instalation
  2. XInputManager
  3. Controller
  4. Controller-enum's
  5. ControllersManager

Links

Clone this wiki locally