mini_arcade_core.utils¶
Mini Arcade Core Utilities Package
Submodules¶
Attributes¶
Classes¶
Simple frame timer for marking and reporting time intervals. |
Functions¶
|
Find an assets directory by walking upward from an anchor file path. |
|
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:
- 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.