flame_gamepads¶
flame_gamepads provides helping bridge functionality to use the gamepads package in your flame
game.
GamepadCallbacks mixin¶
Add GamepadCallbacks mixin to your component with the with keyword and override the
onGamepadEvent method to receive callbacks when a gamepad event occurs.
class PlayerComponent extends PositionComponent with GamepadCallbacks {
@override
void onGamepadEvent(NormalizedGamepadEvent event) {
if (event.button == GamepadButton.a && event.value != 0) {
// 'a' button pressed.
}
}
}
An example of how to use the API can be found here.
See the lib gamepads for more info on how to process the NormalizedGamepadEvent data.
The content on this page is licensed under the CC BY 4.0 License,
and code samples under the MIT License.