0 purchases
xinput gamepad
xinput_gamepad #
Add support to XInput controllers with Win32 API. #
Dependencies #
win32
ffi
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
copied to clipboard
With Flutter
flutter pub add xinput_gamepad
copied to clipboard
See more in install section
Simple example #
Enable XInput:
XInputManager.enableXInput();
copied to clipboard
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.listen();
copied to clipboard
You can get the indexes of the available/connected controllers with:
ControllersManager.getIndexConnectedControllers();
copied to clipboard
See all practical examples here
Documentation #
Access the documentation here
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.