libretro.api.input.mouse¶
Mouse input types, buttons, and axis IDs.
Corresponds to the RETRO_DEVICE_ID_MOUSE_* constants in libretro.h.
Classes
Input IDs for the mouse device. |
|
Snapshot of mouse state. |
- class DeviceIdMouse[source]¶
Bases:
IntEnumInput IDs for the mouse device.
Corresponds to the
RETRO_DEVICE_ID_MOUSE_*constants inlibretro.h.>>> from libretro.api.input import DeviceIdMouse >>> DeviceIdMouse.LEFT <DeviceIdMouse.LEFT: 2>
- X = 0¶
- Y = 1¶
- LEFT = 2¶
- RIGHT = 3¶
- WHEELUP = 4¶
- WHEELDOWN = 5¶
- MIDDLE = 6¶
- HORIZ_WHEELUP = 7¶
- HORIZ_WHEELDOWN = 8¶
- BUTTON_4 = 9¶
- BUTTON_5 = 10¶
- __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 MouseState[source]¶
Bases:
InputDeviceStateSnapshot of mouse state.
>>> from libretro.api.input import MouseState >>> state = MouseState() >>> state.left False
- x¶
- y¶
- left¶
- right¶
- wheel_up¶
- wheel_down¶
- middle¶
- horizontal_wheel_up¶
- horizontal_wheel_down¶
- button4¶
- button5¶
- __init__(x=0, y=0, left=False, right=False, wheel_up=False, wheel_down=False, middle=False, horizontal_wheel_up=False, horizontal_wheel_down=False, button4=False, button5=False)¶
- classmethod __new__(*args, **kwargs)¶
- self[item][source]¶
- Overloads:
self, item (DeviceIdMouseAxis) → int
self, item (DeviceIdMouseButton | DeviceIdMouseWheel) → bool
self, item (int) → bool | int
Get the state of a specific mouse input by its ID.
For example:
>>> from libretro.api.input import MouseState, DeviceIdMouse >>> state = MouseState(x=123, left=True) >>> state[DeviceIdMouse.X] 123 >>> state[DeviceIdMouse.LEFT] True
- Parameters:
item (
DeviceIdMouse|int) – The ID of the input to query, as aDeviceIdMouseor integer.- Returns:
The state of the specified input, as an
intfor axes orboolfor buttons. Note that wheel inputs are treated as buttons that are “pressed” when the wheel is moved in the corresponding direction.- Raises:
KeyError – If
itemisn’t a valid input ID.IndexError – If
itemis an integer but not a valid input ID