import RenderComponent from './RenderComponent.js'; /** * Component that holds data for rendering a tilemap. */ export default class TilemapComponent extends RenderComponent { /** The source image for the tileset. */ tileset: HTMLImageElement; /** 2D array of tile indices. */ data: number[][]; /** Tile size in pixels. */ tileSize: number; /** Number of columns in the tileset image. */ tilesetCols: number; constructor(tileset: HTMLImageElement, data: number[][], tileSize: number, tilesetCols: number); /** * Ensures the parent GameObject has a BoundsComponent synced with this tilemap. * Note: Bounds represent the BASE local size (unscaled). */ private _updateGameObjectBounds; /** * Lifecycle hook called when the component is added to a GameObject. */ onAttach(): void; /** * Draws the tilemap to the canvas. * @param ctx The canvas 2D rendering context. */ draw(ctx: CanvasRenderingContext2D): void; }