libretro.api.input.lightgun¶
Light gun input types, button and axis IDs.
Corresponds to the RETRO_DEVICE_ID_LIGHTGUN_* constants in libretro.h.
Classes
Input IDs for the light gun device. |
|
Snapshot of a light gun's state. |
- class DeviceIdLightgun[source]¶
Bases:
IntEnumInput IDs for the light gun device.
Corresponds to the
RETRO_DEVICE_ID_LIGHTGUN_*constants inlibretro.h.>>> from libretro.api.input import DeviceIdLightgun >>> DeviceIdLightgun.TRIGGER <DeviceIdLightgun.TRIGGER: 2>
- SCREEN_X = 13¶
- SCREEN_Y = 14¶
- IS_OFFSCREEN = 15¶
- TRIGGER = 2¶
- RELOAD = 16¶
- AUX_A = 3¶
- AUX_B = 4¶
- START = 6¶
- SELECT = 7¶
- AUX_C = 8¶
- DPAD_UP = 9¶
- DPAD_DOWN = 10¶
- DPAD_LEFT = 11¶
- DPAD_RIGHT = 12¶
- X = 0¶
- Y = 1¶
- CURSOR = 3¶
- TURBO = 4¶
- PAUSE = 5¶
- __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 LightGunState[source]¶
Bases:
InputDeviceStateSnapshot of a light gun’s state.
>>> from libretro.api.input import LightGunState >>> state = LightGunState() >>> state.trigger False
- screen_x¶
- screen_y¶
- is_offscreen¶
- trigger¶
- reload¶
- aux_a¶
- aux_b¶
- start¶
- select¶
- aux_c¶
- dpad_up¶
- dpad_down¶
- dpad_left¶
- dpad_right¶
- x¶
- y¶
- property cursor¶
Alias of
aux_afor consistency withlibretro.h. Discouraged, but not planned for removal.
- property turbo¶
Alias of
aux_bfor consistency withlibretro.h. Discouraged, but not planned for removal.
- property pause¶
Alias of
startfor consistency withlibretro.h. Discouraged, but not planned for removal.
- __init__(screen_x=0, screen_y=0, is_offscreen=False, trigger=False, reload=False, aux_a=False, aux_b=False, start=False, select=False, aux_c=False, dpad_up=False, dpad_down=False, dpad_left=False, dpad_right=False, x=0, y=0)¶
- classmethod __new__(*args, **kwargs)¶
- self[item][source]¶
- Overloads:
self, item (DeviceIdLightGunAxis) → int
self, item (DeviceIdLightGunButton) → bool
self, item (int) → int | bool
Get the state of a specific light gun input by its ID.
For example:
>>> from libretro.api.input import LightGunState, DeviceIdLightgun >>> state = LightGunState(screen_x=123, trigger=True, aux_a=True) >>> state[DeviceIdLightgun.SCREEN_X] 123 >>> state[DeviceIdLightgun.TRIGGER] True >>> state[DeviceIdLightgun.AUX_A] True
- Parameters:
item (
DeviceIdLightgun|int) – The ID of the button, axis, or action to get the state for.- Returns:
The state of the specified button, axis, or action. Will be an
intfor axes and aboolfor buttons and actions.- Raises:
IndexError – If the index is out of range.
KeyError – If the ID is not a valid DeviceIdLightgun.