mini_arcade_core.engine.commands¶
Command protocol for executing commands with a given context.
Attributes¶
Classes¶
Context for command execution. |
|
A command is the only allowed "write path" from input/systems into: |
|
Queue for storing and executing commands. |
|
Quit the game. |
|
Take a screenshot. |
|
Push a new scene onto the scene stack. |
|
Pop the current scene from the scene stack. |
|
Change the current scene to the specified scene. |
|
Push a scene only if it is not already in the stack. |
|
Remove a specific scene instance from the scene stack. |
|
Toggle the debug overlay scene. |
|
Toggle a post-processing effect on or off. |
|
Start recording a replay to the specified file. |
|
Stop recording the current replay. |
|
Start playing back a replay from the specified file. |
|
Stop playing back the current replay. |
|
Start recording a video. |
|
Stop recording the current video. |
|
Toggle video recording on or off. |
Module Contents¶
- mini_arcade_core.engine.commands.TContext¶
- class mini_arcade_core.engine.commands.CommandContext¶
Context for command execution.
- Variables:
- managers: object¶
- settings: object | None = None¶
- world: object | None = None¶
- class mini_arcade_core.engine.commands.Command¶
Bases:
ProtocolA command is the only allowed “write path” from input/systems into: - scene operations (push/pop/change/quit) - capture - global game lifecycle - later: world mutations (if you pass a world reference)
For now we keep it simple: commands only need RuntimeServices.
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.CommandQueue¶
Queue for storing and executing commands.
- class mini_arcade_core.engine.commands.QuitCommand¶
Bases:
CommandQuit the game.
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.ScreenshotCommand¶
Bases:
CommandTake a screenshot.
- Variables:
None) (label (str |) – Optional label for the screenshot file.
- label: str | None = None¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.PushSceneCommand¶
Bases:
CommandPush a new scene onto the scene stack.
- Variables:
(str) (scene_id) – Identifier of the scene to push.
(bool) (as_overlay) – Whether to push the scene as an overlay.
- scene_id: str¶
- as_overlay: bool = False¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.PopSceneCommand¶
Bases:
CommandPop the current scene from the scene stack.
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.ChangeSceneCommand¶
Bases:
CommandChange the current scene to the specified scene.
- Variables:
(str) (scene_id) – Identifier of the scene to switch to.
- scene_id: str¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.PushSceneIfMissingCommand¶
Bases:
CommandPush a scene only if it is not already in the stack.
- scene_id: str¶
- as_overlay: bool = False¶
- policy: mini_arcade_core.engine.scenes.models.ScenePolicy | None = None¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.RemoveSceneCommand¶
Bases:
CommandRemove a specific scene instance from the scene stack.
- scene_id: str¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.ToggleDebugOverlayCommand¶
Bases:
CommandToggle the debug overlay scene.
- Variables:
DEBUG_OVERLAY_ID – str: Identifier for the debug overlay scene.
- DEBUG_OVERLAY_ID = 'debug_overlay'¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.ToggleEffectCommand¶
Bases:
CommandToggle a post-processing effect on or off.
- Variables:
(str) (effect_id) – Identifier of the effect to toggle.
- effect_id: str¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.StartReplayRecordCommand¶
Bases:
CommandStart recording a replay to the specified file.
- Variables:
(str) (initial_scene) – The filename to save the replay to.
(str) – Identifier of the game.
(str) – The initial scene of the replay.
(int) (fps) – The random seed used in the replay.
(int) – Frames per second for the replay.
- filename: str¶
- game_id: str = 'mini-arcade'¶
- initial_scene: str = 'unknown'¶
- seed: int = 0¶
- fps: int = 60¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.StopReplayRecordCommand¶
Bases:
CommandStop recording the current replay.
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.StartReplayPlayCommand¶
Bases:
CommandStart playing back a replay from the specified file.
- Variables:
(str) (path) – The path to the replay file.
(bool) (change_scene) – Whether to change to the replay’s initial scene.
- path: str¶
- change_scene: bool = True¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.StopReplayPlayCommand¶
Bases:
CommandStop playing back the current replay.
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.StartVideoRecordCommand¶
Bases:
CommandStart recording a video.
- Variables:
(int) (capture_fps) – Frames per second for the video.
(int) – Frames per second for capturing frames.
- fps: int = 60¶
- capture_fps: int = 30¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.StopVideoRecordCommand¶
Bases:
CommandStop recording the current video.
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).
- class mini_arcade_core.engine.commands.ToggleVideoRecordCommand¶
Bases:
CommandToggle video recording on or off.
- Variables:
(int) (capture_fps) – Frames per second for the video.
(int) – Frames per second for capturing frames.
- fps: int = 60¶
- capture_fps: int = 30¶
- execute(context: CommandContext)¶
Execute the command with the given world and runtime services.
- Parameters:
services (RuntimeServices) – Runtime services for command execution.
commands (object | None) – Optional command queue for command execution.
settings (object | None) – Optional settings object for command execution.
world (object | None) – The world object (can be any type).