mini_arcade_core.scenes.systems.builtins.actions¶
Action-map based input bindings for scene systems.
Attributes¶
Classes¶
Normalized per-action state. |
|
Per-frame snapshot for all mapped actions. |
|
Strategy contract for one logical action binding. |
|
Digital action sourced from keyboard and/or named buttons. |
|
Axis action sourced from analog axes and optional digital fallbacks. |
|
Mapping of action IDs to concrete binding strategies. |
|
Input system that converts an ActionMap snapshot into scene intent. |
Module Contents¶
- mini_arcade_core.scenes.systems.builtins.actions.TContext¶
- mini_arcade_core.scenes.systems.builtins.actions.TIntent¶
- class mini_arcade_core.scenes.systems.builtins.actions.ActionState¶
Normalized per-action state.
- value: float = 0.0¶
- down: bool = False¶
- pressed: bool = False¶
- released: bool = False¶
- class mini_arcade_core.scenes.systems.builtins.actions.ActionSnapshot¶
Per-frame snapshot for all mapped actions.
- state(action: str) ActionState¶
Get the ActionState for the given action, or a default if not found.
- Parameters:
action (str) – The name of the action to get the state for.
- Returns:
The ActionState for the given action, or a default if not found.
- Return type:
- value(action: str, default: float = 0.0) float¶
Get the normalized value of the action, or a default if not found.
- Parameters:
action (str) – The name of the action to get the value for.
default (float) – The default value to return if the action is not found (default 0.0).
- Returns:
The normalized value of the action, or the default if not found.
- Return type:
float
- down(action: str) bool¶
Check if the action is currently held down.
- Parameters:
action (str) – The name of the action to check.
- Returns:
True if the action is currently held down, False otherwise.
- Return type:
bool
- pressed(action: str) bool¶
Check if the action was pressed this frame.
- Parameters:
action (str) – The name of the action to check.
- Returns:
True if the action was pressed this frame, False otherwise.
- Return type:
bool
- released(action: str) bool¶
Check if the action was released this frame.
- Parameters:
action (str) – The name of the action to check.
- Returns:
True if the action was released this frame, False otherwise.
- Return type:
bool
- class mini_arcade_core.scenes.systems.builtins.actions.ActionBinding¶
Bases:
ProtocolStrategy contract for one logical action binding.
- read(frame: mini_arcade_core.runtime.input_frame.InputFrame) ActionState¶
Read the current state of this action from the input frame.
- Parameters:
frame (InputFrame) – The input frame containing raw input states.
- Returns:
The current ActionState for this binding.
- Return type:
- class mini_arcade_core.scenes.systems.builtins.actions.DigitalActionBinding¶
Bases:
ActionBindingDigital action sourced from keyboard and/or named buttons.
- keys: tuple[mini_arcade_core.backend.keys.Key, Ellipsis] = ()¶
- buttons: tuple[str, Ellipsis] = ()¶
- read(frame: mini_arcade_core.runtime.input_frame.InputFrame) ActionState¶
Read the current state of this action from the input frame.
- Parameters:
frame (InputFrame) – The input frame containing raw input states.
- Returns:
The current ActionState for this binding.
- Return type:
- class mini_arcade_core.scenes.systems.builtins.actions.AxisActionBinding¶
Bases:
ActionBindingAxis action sourced from analog axes and optional digital fallbacks.
- axes: tuple[str, Ellipsis] = ()¶
- positive_keys: tuple[mini_arcade_core.backend.keys.Key, Ellipsis] = ()¶
- negative_keys: tuple[mini_arcade_core.backend.keys.Key, Ellipsis] = ()¶
- positive_buttons: tuple[str, Ellipsis] = ()¶
- negative_buttons: tuple[str, Ellipsis] = ()¶
- deadzone: float = 0.15¶
- scale: float = 1.0¶
- read(frame: mini_arcade_core.runtime.input_frame.InputFrame) ActionState¶
Read the current state of this action from the input frame.
- Parameters:
frame (InputFrame) – The input frame containing raw input states.
- Returns:
The current ActionState for this binding.
- Return type:
- class mini_arcade_core.scenes.systems.builtins.actions.ActionMap¶
Mapping of action IDs to concrete binding strategies.
- bindings: Mapping[str, ActionBinding]¶
- read(frame: mini_arcade_core.runtime.input_frame.InputFrame) ActionSnapshot¶
Read the current state of all actions from the input frame.
- Parameters:
frame (InputFrame) – The input frame containing raw input states.
- Returns:
An ActionSnapshot containing the state of all actions.
- Return type:
- class mini_arcade_core.scenes.systems.builtins.actions.ActionIntentSystem¶
Bases:
mini_arcade_core.scenes.systems.base_system.BaseSystem[TContext],Generic[TContext,TIntent]Input system that converts an ActionMap snapshot into scene intent.
- intent_factory: Callable[[ActionSnapshot, TContext], TIntent]¶
- name: str = 'action_intent'¶
- order: int = 10¶
- step(ctx: TContext) None¶
Perform a single step of the system within the given context.
- Parameters:
ctx (TSystemContext) – The system context.