UNPKG

roguelike-pumpkin-patch

Version:
53 lines (52 loc) 1.91 kB
import { TileSize, Position, TileOptions } from './DisplayInterfaces.js'; /** Class to keep track of each individual tile in the display */ export default class Tile { /** Contents of the tile */ private contentElement; private _content; /** Background colour. */ private _background; /** Foreground colour */ private _color; /** Position */ private _position; /** Size of a title, in CSS units */ private _tileHeight; private _tileWidth; private _classList; /** Element this tile corresponds to in the DOM */ readonly element: HTMLDivElement; constructor(tileOptions: TileOptions, position: Position, tileSize?: TileSize); /** Get or set the tile contents */ get content(): string | HTMLElement; set content(newContent: string | HTMLElement); /** Get or set the background colour */ get background(): string; set background(newBackground: string); /** Get or set the color colour */ get color(): string; set color(newcolor: string); /** Get or set position */ get position(): Position; set position(position: Position); /** Get or set tile width */ get tileWidth(): number; set tileWidth(newWidth: number); /** Get or set the tile height */ get tileHeight(): number; set tileHeight(newHeight: number); /** Get or set the classname */ get className(): string; set className(newClass: string); /** Get or set the list of classes */ get classList(): Array<string>; set classList(newClassList: Array<string>); /** Set options for the tile */ setOptions(newOptions: TileOptions): void; /** * Update options for the tile */ updateOptions(newOptions: TileOptions): void; /** Check if a contentElement exists, and if it doesn't, add it */ confirmContentElement(): void; }