jacdac.gamepad
Submodules
Package Contents
Classes
A two axis directional gamepad with optional buttons. |
- class jacdac.gamepad.GamepadClient(bus: jacdac.bus.Bus, role: str, *, missing_direction_value: Optional[Tuple[jacdac.gamepad.constants.GamepadButtons, float, float]] = None)
Bases:
jacdac.bus.SensorClient
A two axis directional gamepad with optional buttons. Implements a client for the Gamepad service.
- property direction Optional[Tuple[jacdac.gamepad.constants.GamepadButtons, float, float]]
If the gamepad is analog, the directional buttons should be “simulated”, based on gamepad position (Left is { x = -1, y = 0 }, Up is { x = 0, y = -1}). If the gamepad is digital, then each direction will read as either -1, 0, or 1 (in fixed representation). The primary button on the gamepad is A., x: /,y: /
- property variant Optional[jacdac.gamepad.constants.GamepadVariant]
(Optional) The type of physical gamepad.,
- property buttons_available Optional[jacdac.gamepad.constants.GamepadButtons]
Indicates a bitmask of the buttons that are mounted on the gamepad. If the Left/Up/Right/Down buttons are marked as available here, the gamepad is digital. Even when marked as not available, they will still be simulated based on the analog gamepad.,
- on_buttons_changed(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn
Emitted whenever the state of buttons changes.