import { P as PhysicsMetricsData } from '../PhysicsMetrics-QzFDRdGh.js'; /** * Canvas-based debug overlay that visualises per-step physics metrics. * * Renders (top → bottom, uniform gaps): * 1. Step time (ms) * 2. Rolling step-time graph * 3. Phase breakdown bar (1-second average) + legend with percentages * 4. Entity counters * * The overlay auto-enables `space.profilerEnabled` when constructed. * * @example * ```ts * import { PerformanceOverlay } from "nape-js/profiler"; * * const overlay = new PerformanceOverlay(space, { canvas: myCanvas }); * // In game loop, after space.step(): * overlay.update(); * ``` */ /** Options for {@link PerformanceOverlay}. */ interface PerformanceOverlayOptions { /** Target canvas element. If omitted, a new one is created and appended to `document.body`. */ canvas?: HTMLCanvasElement; /** Corner position of the overlay. Default: `"top-left"`. */ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"; /** Overlay width in CSS pixels. Default: `260`. */ width?: number; /** Overlay height in CSS pixels. Auto-computed from enabled sections if omitted. */ height?: number; /** Number of frames kept in the rolling history graph. Default: `120`. */ graphHistory?: number; /** Show the rolling step-time graph. Default: `true`. */ showGraph?: boolean; /** Show entity counters. Default: `true`. */ showCounters?: boolean; /** Show phase breakdown bar. Default: `true`. */ showBreakdown?: boolean; /** Background colour (any CSS colour string). Default: `"rgba(13,17,23,0.88)"`. */ backgroundColor?: string; /** Text colour (any CSS colour string). Default: `"#00ff88"`. */ textColor?: string; /** Scale factor for HiDPI displays. Default: `window.devicePixelRatio ?? 1`. */ scale?: number; } /** Minimal Space-like interface so the overlay doesn't import the full engine. */ interface SpaceLike { profilerEnabled: boolean; metrics: PhysicsMetricsData; } declare class PerformanceOverlay { private readonly space; private readonly canvas; private readonly ctx; private readonly opts; private readonly history; private readonly phaseAccum; private readonly phaseDisplay; private historyIndex; private ownedCanvas; private lastTime; private frameCount; private fps; private fpsAccum; private accumFrames; private lastFlush; constructor(space: SpaceLike, options?: PerformanceOverlayOptions); /** Update the overlay. Call once per frame after `space.step()`. */ update(): void; /** Remove the overlay canvas from the DOM (only if it was auto-created). */ destroy(): void; private _computeHeight; private _applyPosition; private _render; } export { PerformanceOverlay, type PerformanceOverlayOptions, PhysicsMetricsData };