libretro.api.input.joypad

Joypad (RetroPad) button input types.

Corresponds to the RETRO_DEVICE_ID_JOYPAD_* constants in libretro.h.

Classes

DeviceIdJoypad

Button IDs for the standard joypad.

JoypadState

Snapshot of a standard joypad's button states.

class DeviceIdJoypad[source]

Bases: IntEnum

Button IDs for the standard joypad.

Corresponds to the RETRO_DEVICE_ID_JOYPAD_* constants in libretro.h.

>>> from libretro.api.input import DeviceIdJoypad
>>> DeviceIdJoypad.A
<DeviceIdJoypad.A: 8>
B = 0
Y = 1
SELECT = 2
START = 3
UP = 4
DOWN = 5
LEFT = 6
RIGHT = 7
A = 8
X = 9
L = 10
R = 11
L2 = 12
R2 = 13
L3 = 14
R3 = 15
MASK = 256
__new__(value)
classmethod value in self

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)

classmethod self[name]

Return the member matching name.

__init__()
classmethod iter(self)

Return members in definition order.

classmethod len(self)

Return the number of members (no aliases)

class JoypadState[source]

Bases: InputDeviceState

Snapshot of a standard joypad’s button states.

>>> from libretro.api.input import JoypadState
>>> state = JoypadState(a=True)
>>> state.a
True
b
y
select
start
up
down
left
right
a
x
l
r
l2
r2
l3
r3
self[item][source]
Overloads:
  • self, item (Literal[DeviceIdJoypad.MASK]) → int

  • self, item (DeviceIdJoypadButton) → bool

  • self, item (int) → bool | int

Get the state of a joypad button or the bitmask of all buttons.

>>> from libretro.api.input import JoypadState, DeviceIdJoypad
>>> state = JoypadState(a=True)
>>> state[DeviceIdJoypad.A]
True
>>> state[DeviceIdJoypad.MASK]
256
__init__(b=False, y=False, select=False, start=False, up=False, down=False, left=False, right=False, a=False, x=False, l=False, r=False, l2=False, r2=False, l3=False, r3=False)
classmethod __new__(*args, **kwargs)
property mask

Bitmask of all button states, where bit 0 corresponds to B, bit 1 to Y, and so on.