Skip to content

Interface

Input

class Input()

Protocol for implementing input handlers.

Implementations of [Input] are used as input handlers, which then can be swapped at runtime.

Example: You have a game that takes input from the keyboard, until a controller is detected.

capture_states

def capture_states() -> None

is_action_pressed

def is_action_pressed(action: Action) -> bool

is_action_just_pressed

def is_action_just_pressed(action: Action) -> bool

get_vector

def get_vector(
    negative_x: Action,
    positive_x: Action,
    negative_y: Action,
    positive_y: Action,
) -> Vec2