import type { Vec2, Rect } from '../core/types';
export interface TileDef {
    id: number;
    name: string;
    /** Source rect in the tileset spritesheet. */
    srcRect: Rect;
    solid: boolean;
    /** Collision shape override (aabb by default). */
    collisionShape?: 'none' | 'full' | 'half-top' | 'half-bottom' | 'slope-left' | 'slope-right';
    /** Custom properties. */
    properties?: Record<string, unknown>;
}
export interface TilesetDef {
    name: string;
    imageId: string;
    tileWidth: number;
    tileHeight: number;
    columns: number;
    tiles: TileDef[];
}
export interface TilemapLayer {
    name: string;
    visible: boolean;
    opacity: number;
    /** 2D array: data[y][x] = tileId (0 = empty). */
    data: number[][];
}
export interface TilemapData {
    width: number;
    height: number;
    tileWidth: number;
    tileHeight: number;
    tilesetId: string;
    layers: TilemapLayer[];
}
export declare class Tilemap {
    readonly width: number;
    readonly height: number;
    readonly tileWidth: number;
    readonly tileHeight: number;
    private layers;
    private tileset;
    constructor(width: number, height: number, tileWidth?: number, tileHeight?: number);
    get pixelWidth(): number;
    get pixelHeight(): number;
    setTileset(ts: TilesetDef): void;
    getTileset(): TilesetDef | null;
    addLayer(name: string): TilemapLayer;
    getLayer(name: string): TilemapLayer | undefined;
    getLayers(): TilemapLayer[];
    getTile(layerName: string, x: number, y: number): number;
    setTile(layerName: string, x: number, y: number, tileId: number): void;
    /** Fill a rectangle with a tile. */
    fillRect(layerName: string, x: number, y: number, w: number, h: number, tileId: number): void;
    /** Flood fill from a position. */
    floodFill(layerName: string, x: number, y: number, tileId: number): void;
    worldToTile(worldX: number, worldY: number): Vec2;
    tileToWorld(tileX: number, tileY: number): Vec2;
    isSolid(tileX: number, tileY: number): boolean;
    /** Get all solid tiles overlapping a world-space AABB. */
    getSolidTilesInRect(rect: Rect): Vec2[];
    render(ctx: CanvasRenderingContext2D, tilesetImage: HTMLImageElement | HTMLCanvasElement, camera: Rect): void;
    toJSON(): TilemapData;
    static fromJSON(data: TilemapData): Tilemap;
}
export declare function computeAutoTileMask(map: Tilemap, layerName: string, x: number, y: number): number;
