mini_arcade_core.scenes.systems

Scene system primitives.

Submodules

Attributes

Classes

BaseSystem

Protocol for a system that operates within a given context.

SystemPhase

High-level execution buckets for scene systems.

SystemBundle

Structural contract for a bundle that expands into multiple systems.

SystemPipeline

Pipeline for managing and executing systems in order.

Package Contents

class mini_arcade_core.scenes.systems.BaseSystem[source]

Bases: Protocol, Generic[TSystemContext]

Protocol for a system that operates within a given context.

name: str
phase: int
order: int = 0
enabled(ctx: TSystemContext) bool[source]

Determine if the system is enabled in the given context.

Parameters:

ctx (TSystemContext) – The system context.

Returns:

True if the system is enabled, False otherwise.

Return type:

bool

step(ctx: TSystemContext)[source]

Perform a single step of the system within the given context.

Parameters:

ctx (TSystemContext) – The system context.

mini_arcade_core.scenes.systems.TSystemContext
class mini_arcade_core.scenes.systems.SystemPhase[source]

Bases: enum.IntEnum

High-level execution buckets for scene systems.

Keep values spaced to leave room for future insertions without churn.

INPUT = 10
CONTROL = 20
SIMULATION = 30
PRESENTATION = 40
RENDERING = 50
class mini_arcade_core.scenes.systems.SystemBundle[source]

Bases: Protocol, Generic[mini_arcade_core.scenes.systems.base_system.TSystemContext]

Structural contract for a bundle that expands into multiple systems.

iter_systems() Iterable[mini_arcade_core.scenes.systems.base_system.BaseSystem[mini_arcade_core.scenes.systems.base_system.TSystemContext]][source]

Return the concrete systems that should be added to the pipeline.

class mini_arcade_core.scenes.systems.SystemPipeline[source]

Bases: Generic[mini_arcade_core.scenes.systems.base_system.TSystemContext]

Pipeline for managing and executing systems in order.

Variables:

(List[BaseSystem[TSystemContext]]) (systems) – List of systems in the pipeline.

systems: List[mini_arcade_core.scenes.systems.base_system.BaseSystem[mini_arcade_core.scenes.systems.base_system.TSystemContext]] = []
static insertion_sort(arr)[source]

Sorts a list of elements using the Insertion Sort algorithm.

add(system: mini_arcade_core.scenes.systems.base_system.BaseSystem[mini_arcade_core.scenes.systems.base_system.TSystemContext] | mini_arcade_core.scenes.systems.system_bundle.SystemBundle[mini_arcade_core.scenes.systems.base_system.TSystemContext])[source]

Add a system to the pipeline and sort by order.

Parameters:

system (BaseSystem[TSystemContext] | SystemBundle[TSystemContext]) – The system to add.

extend(systems: Iterable[mini_arcade_core.scenes.systems.base_system.BaseSystem[mini_arcade_core.scenes.systems.base_system.TSystemContext] | mini_arcade_core.scenes.systems.system_bundle.SystemBundle[mini_arcade_core.scenes.systems.base_system.TSystemContext]])[source]

Extend the pipeline with multiple systems.

Parameters:

systems (Iterable[BaseSystem[TSystemContext] | SystemBundle[TSystemContext]]) – An iterable of systems to add.

step(ctx: mini_arcade_core.scenes.systems.base_system.TSystemContext)[source]

Execute a step for each system in the pipeline.

Parameters:

ctx (TSystemContext) – The system context.