Kraken Logo

Kraken Engine

DocumentationGuidesShowcaseCommunity
Ctrl
K
Navigating the Docs
Building Docs
Overview
Camera
Color
Draw
Ease
Event
Fx
Gamepad
Input
Log
Math
Mixer
Mouse
Physics
Pixel Array
Renderer
Shaders
Time
Transform
Ui
Viewport
Window

Built bydurkisneer1.Kraken Engine is open source and available onGitHub.

  1. Docs
  2. Functions
  3. Gamepad

Gamepad

Gamepad input handling functions


Is Pressed

is_pressed(button: GamepadButton, slot: int = 0) → boolis_pressed(button: GamepadButton, slot: int = 0) → bool

Check 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

is_just_pressed(button: GamepadButton, slot: int = 0) → boolis_just_pressed(button: GamepadButton, slot: int = 0) → bool

Check 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

is_just_released(button: GamepadButton, slot: int = 0) → boolis_just_released(button: GamepadButton, slot: int = 0) → bool

Check 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

get_left_stick(slot: int = 0) → Vec2get_left_stick(slot: int = 0) → Vec2

Get 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

get_right_stick(slot: int = 0) → Vec2get_right_stick(slot: int = 0) → Vec2

Get 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

get_left_trigger(slot: int = 0) → floatget_left_trigger(slot: int = 0) → float

Get 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

get_right_trigger(slot: int = 0) → floatget_right_trigger(slot: int = 0) → float

Get 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

set_deadzone(deadzone: float, slot: int = 0) → Noneset_deadzone(deadzone: float, slot: int = 0) → None

Set 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

get_deadzone(slot: int = 0) → floatget_deadzone(slot: int = 0) → float

Get 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

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

get_type(slot: int = 0) → GamepadTypeget_type(slot: int = 0) → GamepadType

Get 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.

PreviousFx
NextInput

On this page

Is PressedIs Just PressedIs Just ReleasedGet Left StickGet Right StickGet Left TriggerGet Right TriggerSet DeadzoneGet DeadzoneGet Connected SlotsGet Type