mini_arcade_core.scenes.systems.builtins.actions

Action-map based input bindings for scene systems.

Attributes

Classes

ActionState

Normalized per-action state.

ActionSnapshot

Per-frame snapshot for all mapped actions.

ActionBinding

Strategy contract for one logical action binding.

DigitalActionBinding

Digital action sourced from keyboard and/or named buttons.

AxisActionBinding

Axis action sourced from analog axes and optional digital fallbacks.

ActionMap

Mapping of action IDs to concrete binding strategies.

ActionIntentSystem

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:

ActionState

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: Protocol

Strategy 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:

ActionState

class mini_arcade_core.scenes.systems.builtins.actions.DigitalActionBinding

Bases: ActionBinding

Digital 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:

ActionState

class mini_arcade_core.scenes.systems.builtins.actions.AxisActionBinding

Bases: ActionBinding

Axis 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:

ActionState

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:

ActionSnapshot

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.

action_map: ActionMap
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.