Skip to content

Controller

Controller

class Controller()

[Controller] implementation for [Input] handler.

Controller.default_action_binds

ClassVar

Trigger

class Trigger()

Limit

class Limit(Enum)

Limit.POSITIVE

Limit.NEGATIVE

__init__

def __init__(
    axis: Controller.Axis,
    limit: Controller.Trigger.Limit | None = None,
    deadzone: Positive[Percent] = 10,
) -> None

__init__

def __init__(
    action_binds: Controller.ActionBinds | None = None,
    device_id: Controller.DeviceID | None = None,
) -> None

capture_states

def capture_states() -> None

Capture all action state.

If instantiated with handler = Controller[MyAction](), then MyAction will be available at runtime. Therefore, by calling this method, all actions are ensured they map correctly from an action variant to its state.

NOTE Requires pygame.event.pump to be called before capture_states.

is_action_pressed

def is_action_pressed(action: Action) -> bool

is_action_just_pressed

def is_action_just_pressed(action: Action) -> bool