import type { Vec2, Color } from '../core/types'; import { EventBus } from '../core/EventBus'; export type UIAnchor = 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'; export type UIElementType = 'text' | 'bar' | 'image' | 'panel' | 'button' | 'container'; export interface UIStyle { fontSize?: number; fontFamily?: string; color?: Color; backgroundColor?: Color; borderColor?: Color; borderWidth?: number; borderRadius?: number; padding?: number; opacity?: number; visible?: boolean; } export interface UIElement { id: string; type: UIElementType; /** Position relative to anchor (px). */ position: Vec2; anchor: UIAnchor; size: { width: number; height: number; }; style: UIStyle; /** For text/button elements. */ text?: string; /** For bar elements (0-1). */ value?: number; /** For image elements. */ imageId?: string; /** Children for container type. */ children?: string[]; /** Whether this element can receive focus. */ focusable?: boolean; /** Callback action name for button click/select. */ action?: string; /** Custom data. */ data?: Record; enabled: boolean; visible: boolean; } export interface UITheme { name: string; fontFamily: string; fontSize: number; textColor: Color; panelColor: Color; panelBorder: Color; accentColor: Color; focusColor: Color; disabledColor: Color; buttonColor: Color; buttonHoverColor: Color; barFillColor: Color; barBgColor: Color; } export declare class GameUI { readonly events: EventBus; private elements; private layers; private _theme; private _focusedId; private _focusOrder; private _screenSize; get theme(): Readonly; set theme(t: Partial); get focusedElement(): string | null; setScreenSize(w: number, h: number): void; addElement(el: UIElement, layerIndex?: number): void; removeElement(id: string): void; getElement(id: string): UIElement | undefined; clear(): void; focusNext(): void; focusPrev(): void; setFocus(id: string | null): void; /** Activate (select/click) the currently focused element. */ activateFocused(): void; createText(id: string, text: string, anchor?: UIAnchor, pos?: Vec2, style?: Partial): UIElement; createBar(id: string, value: number, anchor?: UIAnchor, pos?: Vec2, size?: { width: number; height: number; }): UIElement; createButton(id: string, text: string, action: string, anchor?: UIAnchor, pos?: Vec2): UIElement; createPanel(id: string, anchor?: UIAnchor, pos?: Vec2, size?: { width: number; height: number; }): UIElement; render(ctx: CanvasRenderingContext2D): void; private renderText; private renderBar; private renderButton; private renderPanel; private resolveAnchorPosition; }