Gamepad input handling functions
is_pressed(button: GamepadButton, slot: int = 0) → boolis_pressed(button: GamepadButton, slot: int = 0) → boolCheck if a gamepad button is currently being held down.
Args
button : The button code.slot : Gamepad slot ID (default is 0).Returns
bool : True if the button is pressed.
is_just_pressed(button: GamepadButton, slot: int = 0) → boolis_just_pressed(button: GamepadButton, slot: int = 0) → boolCheck if a gamepad button was pressed during this frame.
Args
button : The button code.slot : Gamepad slot ID (default is 0).Returns
bool : True if the button was just pressed.
is_just_released(button: GamepadButton, slot: int = 0) → boolis_just_released(button: GamepadButton, slot: int = 0) → boolCheck if a gamepad button was released during this frame.
Args
button : The button code.slot : Gamepad slot ID (default is 0).Returns
bool : True if the button was just released.
get_left_stick(slot: int = 0) → Vec2get_left_stick(slot: int = 0) → Vec2Get the left analog stick position.
Args
slot : Gamepad slot ID (default is 0).Returns
Vec2 : A vector of stick input normalized to [-1, 1], or (0, 0) if inside dead zone.
get_right_stick(slot: int = 0) → Vec2get_right_stick(slot: int = 0) → Vec2Get the right analog stick position.
Args
slot : Gamepad slot ID (default is 0).Returns
Vec2 : A vector of stick input normalized to [-1, 1], or (0, 0) if inside dead zone.
get_left_trigger(slot: int = 0) → floatget_left_trigger(slot: int = 0) → floatGet the left trigger's current pressure value.
Args
slot : Gamepad slot ID (default is 0).Returns
float : Trigger value in range [0.0, 1.0].
get_right_trigger(slot: int = 0) → floatget_right_trigger(slot: int = 0) → floatGet the right trigger's current pressure value.
Args
slot : Gamepad slot ID (default is 0).Returns
float : Trigger value in range [0.0, 1.0].
set_deadzone(deadzone: float, slot: int = 0) → Noneset_deadzone(deadzone: float, slot: int = 0) → NoneSet the dead zone threshold for a gamepad's analog sticks.
Args
deadzone : Value from 0.0 to 1.0 where movement is ignored.slot : Gamepad slot ID (default is 0).get_deadzone(slot: int = 0) → floatget_deadzone(slot: int = 0) → floatGet the current dead zone value for a gamepad's analog sticks.
Args
slot : Gamepad slot ID (default is 0).Returns
float : Deadzone threshold.
get_connected_slots() → list[int]get_connected_slots() → list[int]Get a list of connected gamepad slot indices.
Returns
list[int] : A list of slot IDs with active gamepads.
get_type(slot: int = 0) → GamepadTypeget_type(slot: int = 0) → GamepadTypeGet the type of gamepad connected in a given slot.
Args
slot : Gamepad slot ID (default is 0).Returns
GamepadType : An enum value representing the gamepad type, or Unknown if no gamepad is connected.