GUIText
Constructor
new GUIText(text: string, fontSize: number, fontFamily: string, color: string, fontWeight: number);| Name | Type | Description |
|---|---|---|
| text | string | Text to be displayed |
| fontsize | number | Font size in pixels |
| fontFamily | string | CSS font family |
| color | string | CSS text color |
| fontWeight | number | CSS font weight |
Implements
- GUIElement
Members
public text: string; // Holds current text valuepublic fontSize: number; // Holds current font size valuepublic fontFamily: string; // Holds CSS-like font family valuepublic fontWeight: number; // Holds CSS-like font family valuepublic color: string; // Holds CSS-like color value// Holds position as an { x: number; y: number } object// Default value: { x: 0, y: 0 }public position: { x: number; y: number } = { x: 0, y: 0 };// Returns current text width// Calculated with the object's functionget width(void): number;// Returns current text height// Calculated with the object's functionget height(void): number;// It calculates text with using a false canvas// Used byt width getterprotected getTextWidth(void): number;// It calculates text with using a false canvas// Used byt width getterprotected getTextWidth(void): number;// It's called whenever engine renders the element// It comes from GuiElement interface// *PARAMS*// ctx: CanvasRenderingContext2D - context used to render the element on the canvas context of the game instancepublic render(ctx: CanvasRenderingContext2D): void;