import RenderComponent from './RenderComponent.js'; /** * Types of shapes supported by the ShapeComponent. */ export type ShapeType = 'rect' | 'circle'; /** * Component that holds data for rendering a basic shape. */ export default class ShapeComponent extends RenderComponent { /** The type of shape to draw. */ type: ShapeType; /** Fill colour. */ colour: string; /** Width (for rect) or radius (for circle). */ get width(): number; set width(val: number); /** Height (for rect) or unused (for circle). */ get height(): number; set height(val: number); private _initialWidth; private _initialHeight; constructor(type: ShapeType, colour: string, width?: number, height?: number); /** * Ensures the parent GameObject has a BoundsComponent synced with this shape. * 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 shape to the canvas. * @param ctx The canvas 2D rendering context. */ draw(ctx: CanvasRenderingContext2D): void; }