blaze-2d
Version:
A fast and simple WebGL 2 2D game engine written in TypeScript
52 lines (51 loc) • 1.57 kB
TypeScript
import BlazeElement from "./element";
import "./styles/text.css";
export declare enum TextStyle {
PRIMARY = 0,
SECONDARY = 1,
HIGHLIGHT = 2,
SUCCESS = 3,
ERROR = 4,
WARNING = 5
}
export default class BlazeText<T extends HTMLParagraphElement | HTMLHeadingElement> extends BlazeElement<HTMLParagraphElement | HTMLHeadingElement> {
private text;
size: number;
bold: boolean;
style: TextStyle;
/**
* Create a {@link BlazeText} with a {@link HTMLHeadingElement}.
*
* @param text The element's text
* @param level The heading level (1 - 6)
* @param size The text's size in `rem` units
* @param bold Wether or not the text is bold
* @param style The text's style (color)
*/
constructor(text: string, level: number, size: number, bold?: boolean, style?: TextStyle);
/**
* Create a {@link BlazeText} with a {@link HTMLParagraphElement}.
*
* @param text The element's text
* @param size The text's size in `rem` units
* @param bold Wether or not the text is bold
* @param style The text's style (color)
*/
constructor(text: string, size: number, bold?: boolean, style?: TextStyle);
/**
* Applies the `size`, `bold`, and `style` variables to the text's dom element.
*/
applyStyles(): void;
/**
* Sets the element's text.
*
* @param text The element's text
*/
setText(text: string): void;
/**
* Gets the element's text.
*
* @returns The element's text
*/
getText(): string;
}