import type { HudRect, HudSize } from "./hudLayout.js"; /** Where a game is meant to be played. `"web"` alone keeps today's desktop-first HUD; adding `"mobile"` turns on design-resolution fit scaling on compact displays. */ export type HudPlatform = "web" | "mobile"; /** * Design-resolution fit for the HUD surface. The game authors its UI against * `designSize`; on smaller viewports the whole HUD scales down by the limiting * axis ratio, clamped to `[minScale, maxScale]`, so panels keep their layout * and simply shrink instead of overflowing. */ export interface HudFitConfig { designSize?: HudSize; /** Floor for the computed scale — below this, shrinking further makes text unreadable. Default 0.4. */ minScale?: number; /** Ceiling for the computed scale. Default 1 (never upscale past authored size). */ maxScale?: number; } /** Per-game HUD viewport declaration carried on `PlayableGame.hudFit`; `mobile` overrides the fit on compact displays so the owner can tune the phone layout separately. */ export interface HudViewportConfig extends HudFitConfig { mobile?: HudFitConfig; } export declare const DEFAULT_HUD_DESIGN_SIZE: HudSize; export declare const DEFAULT_HUD_MIN_SCALE = 0.4; export declare const DEFAULT_HUD_MAX_SCALE = 1; export declare function resolveHudFit(config: HudViewportConfig | undefined, mobile: boolean): Required; /** * The one scaling rule for every display: the ratio of the live viewport to * the authored design size along the limiting axis, clamped. 1 on a viewport * at or above design size; smoothly below 1 down to `minScale` on phones. */ export declare function hudScaleForViewport(fit: Required, viewport: HudSize): number; export interface HudOverflow { id: string; left: number; top: number; right: number; bottom: number; } /** Non-null when any edge of `rect` falls outside `viewport` by more than `tolerance` px; each field is the overflow distance past that edge (0 when inside). */ export declare function rectOverflow(rect: HudRect, viewport: HudSize, tolerance?: number): Omit | null; /** * True when at least `minVisiblePx²` of `rect` actually falls inside `viewport`. * The boundary check uses this to tell a *shown* surface from a *closed* one: a * mail drawer parked fully off-screen (or a menu that has not been opened) never * intersects the viewport, so it is not "escaping" — it is simply not on screen. * Only a surface that is partly visible and partly past an edge is a real defect. * * @internal Consumed transitively through {@link overflowingPanels}; exported for unit tests. */ export declare function rectIntersectsViewport(rect: HudRect, viewport: HudSize, minVisiblePx?: number): boolean; /** * Every panel rect that escapes the viewport — the data behind the HUD overflow * gate. A rect is only reported when it is partly visible *and* crosses an edge; * a fully off-screen (closed/hidden) surface is skipped, so parked drawers and * unopened menus never raise a false alarm. */ export declare function overflowingPanels(panels: readonly { id: string; rect: HudRect; }[], viewport: HudSize, tolerance?: number): HudOverflow[];