-
Notifications
You must be signed in to change notification settings - Fork 2
Home
ROG edited this page Jul 25, 2022
·
4 revisions
xinput_gamepad is a package that handle a XInput controller inputs with FFI calls to Win32 API.
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. |