blaze-2d
Version:
A fast and simple WebGL 2 2D game engine written in TypeScript
35 lines (34 loc) • 991 B
TypeScript
import BlazeText, { TextStyle } from "./text";
import "./styles/stat.css";
export default class BlazeStat<T> extends BlazeText<HTMLParagraphElement> {
readonly name: string;
private value;
readonly size: number;
/**
* Create a {@link BlazeStat}.
*
* @param name The stat's name
* @param value The stat's default value
* @param size The stat's font size in `rem` units, if none is given then size will be `auto`
* @param bold Wether or not the stat's text is bold
* @param style The style of the element's text
*/
constructor(name: string, value?: T, size?: number, bold?: boolean, style?: TextStyle);
/**
* Update the stat's dom elements.
*/
refresh(): void;
private valueToString;
/**
* Sets the stat's value.
*
* @param value The stat's value
*/
setValue(value: T): void;
/**
* Gets the stat's value.
*
* @returns The stat's value
*/
getValue(): T;
}