mini_arcade_core.utils

Mini Arcade Core Utilities Package

Submodules

Attributes

Classes

FrameTimer

Simple frame timer for marking and reporting time intervals.

Functions

find_assets_root(→ pathlib.Path)

Find an assets directory by walking upward from an anchor file path.

deprecated([reason, version, alternative])

Mark a function as deprecated.

Package Contents

mini_arcade_core.utils.find_assets_root(anchor: str) pathlib.Path

Find an assets directory by walking upward from an anchor file path.

Parameters:

anchor (str) – File path used as the search starting point.

Raises:

FileNotFoundError – If assets directory cannot be found.

mini_arcade_core.utils.deprecated(reason: str | None = None, version: str | None = None, alternative: str | None = None)

Mark a function as deprecated.

Parameters:
  • reason (str | None) – Optional reason for deprecation

  • version (str | None) – Optional version when it will be removed

  • alternative (str | None) – Optional alternative function to use

mini_arcade_core.utils.logger
class mini_arcade_core.utils.FrameTimer

Simple frame timer for marking and reporting time intervals.

Variables:
  • (FrameTimerConfig) (config) – Configuration for the timer.

  • (FrameTimingFormatter) (formatter) – Formatter for timing reports.

  • float]) (marks (Dict[str,) – Recorded time marks.

config: FrameTimerConfig
formatter: FrameTimingFormatter
marks: Dict[str, float]
clear()

Clear all recorded marks.

mark(name: str)

Record a time mark with the given name.

Parameters:

name (str) – Name of the mark.

report_ms() Dict[str, float]

Returns diffs between consecutive marks in insertion order.

Returns:

Dictionary mapping “start->end” to time difference in milliseconds.

Return type:

Dict[str, float]

should_report(frame_index: int) bool

Determine if a report should be emitted for the given frame index.

Parameters:

frame_index (int) – Current frame index.

Returns:

True if a report should be emitted, False otherwise.

Return type:

bool

emit(frame_index: int)

Emit a timing report to the performance logger.

Parameters:

frame_index (int) – Current frame index.