pyxen.input.gamepads
Access connected game controllers.
pads = pyxen.input.gamepads
Accessing a Gamepad
pad = pads[0]
If index is invalid → error.
Properties
| Property | Type | Description |
|---|---|---|
connected | bool | Whether controller is connected |
left_stick | Vector2 | Left analog stick |
right_stick | Vector2 | Right analog stick |
Buttons
Each returns a Button object:
pad.a
pad.b
pad.x
pad.y
pad.start
pad.back
pad.guide
pad.lb
pad.rb
pad.lt
pad.rt
pad.up
pad.down
pad.left
pad.right
pad.left_stick_button
pad.right_stick_button
Each Button object exposes:
| Property | Type | Description |
|---|---|---|
down | bool | True while held |
pressed | bool | True on the frame the button was pressed |
released | bool | True on the frame the button was released |
value | float | Analog value (triggers are 0.0–1.0) |
frames | int | Frames held; 0 on the pressed frame |
Example: Analog Movement
stick = pad.left_stick
player.x += stick.x * 2
player.y += stick.y * 2
Example: Jump Button
if pad.a.pressed:
player.jump()
Notes
- Supports multiple gamepads
- Button objects use same model as keyboard & mouse
- All properties are read-only
Mini samples
Open from Samples & Tutorials inside Pyxen:
- gamepad.left_stick — Drive an entity with the left analog stick.
- gamepad face buttons — A/B/X/Y light up while held.