UNPKG

blaze-2d

Version:

A fast and simple WebGL 2 2D game engine written in TypeScript

65 lines (64 loc) 1.74 kB
import { System } from "../system"; import EditorPane from "./panes/pane"; import "./styles/editor.css"; /** * The number of rows and columns in the editor ui grid. */ export declare const EDITOR_GRID_SIZE = 24; /** * Represents the editor. * * This class also manages the updating of all editor panes. * * The whole UI is split into 24 rows and 24 columns that fill the window. * The column/row indexes go from 0 to 23. */ export default class Editor implements System { canvas: HTMLCanvasElement; editor: HTMLDivElement; panes: EditorPane[]; /** * Creates the editor UI. * * @param canvas The canvas used by {@link Blaze}, if none is provided then the editor will attempt to locate one. */ constructor(canvas?: HTMLCanvasElement); /** * Update the editor. */ update(): void; /** * Create and inject the editor's UI with default layout. */ createUI(): void; /** * Remove the editor's UI from the dom. */ removeUI(): void; /** * Setup the default layout. */ defaultLayout(): void; /** * Refresh the layout of the editor's panes. */ refreshPanes(): void; /** * Returns the `grid-template-areas` style representing the given grid layout. * * @param layout `grid-template-areas` style tag */ private gridLayoutToCSS; /** * Get the grid layout for the current panes in the editor. * * @returns The grid layout */ private getGridLayout; /** * Creates an object with arrays for each row in the UI with lengths of `EDITOR_GRID_SIZE` and filled with `"."`. * * @returns The empty grid layout */ private emptyGridLayout; }