simvx.core.input.events¶
Input binding and event types.
Module Contents¶
Classes¶
A single input binding: maps to a key, mouse button, or gamepad input. |
|
Keyboard input event with rich metadata. |
|
Mouse button input event. |
Functions¶
Parse a combo such as |
Data¶
API¶
- simvx.core.input.events.MODIFIER_NAMES¶
(‘ctrl’, ‘shift’, ‘alt’)
- class simvx.core.input.events.InputBinding[source]¶
A single input binding: maps to a key, mouse button, or gamepad input.
ctrl/shift/altare REQUIRED modifiers, not exclusive ones: a binding that setsshift=Trueonly matches while Shift is held, while a binding that leaves them all False matches whatever else is held. That keeps every unmodified binding behaving as it always has (a jump bound to Space still fires while the player holds Shift to run).Key routing that has to tell one combo from another – the UI navigation actions, which must distinguish Tab from Shift+Tab – compares
- Attr:
key_comboagainst the combo the router built for the event, so there the match is exact.
- key: simvx.core.input.enums.Key | None¶
None
- mouse_button: simvx.core.input.enums.MouseButton | None¶
None
- joy_button: simvx.core.input.enums.JoyButton | None¶
None
- joy_axis: simvx.core.input.enums.JoyAxis | None¶
None
- joy_axis_positive: bool¶
True
- deadzone: float¶
0.2
- ctrl: bool¶
False
- shift: bool¶
False
- alt: bool¶
False
- simvx.core.input.events.key_combo_to_binding(spec: str) simvx.core.input.events.InputBinding | None[source]¶
Parse a combo such as
"shift+tab"into a binding; None when spec is not one.The inverse of :attr:
InputBinding.key_combo, and the one place that spelling is understood: the input map, the project file and anything else that accepts a written binding all resolve combos through here, so a combo that anInputMapaccepts is also one asimvx.tomlcan carry.A bare key name is not a combo (there is nothing before the
+) and returns None, leaving it to the caller’s own key lookup.
- class simvx.core.input.events.InputEventKey(key: simvx.core.input.enums.Key, pressed: bool, echo: bool = False, shift: bool = False, ctrl: bool = False, alt: bool = False, meta: bool = False)[source]¶
Keyboard input event with rich metadata.
Initialization
- __slots__¶
(‘key’, ‘pressed’, ‘echo’, ‘shift’, ‘ctrl’, ‘alt’, ‘meta’, ‘handled’)
- class simvx.core.input.events.InputEventMouse(button: simvx.core.input.enums.MouseButton, pressed: bool, position: tuple[float, float] = (0.0, 0.0), shift: bool = False, ctrl: bool = False, alt: bool = False, meta: bool = False)[source]¶
Mouse button input event.
Initialization
- __slots__¶
(‘button’, ‘pressed’, ‘position’, ‘shift’, ‘ctrl’, ‘alt’, ‘meta’, ‘handled’)