Text2D

Function Description
Text2D.new() Creates an empty Text2D
Text2D.new(String text) Creates a Text2D with initial text
Text2D.new(String text, Vector2D position) Creates a Text2D at position with text
Text2D.new(String text, Vector2D position, Vector2D dimensions) Creates a Text2D at position with text and dimensions
Property Type Description
.position Vector2D Text2D position
.text String Text content
.visible bool Text2D visibility
.size Vector2D Copy of Text2D size
.wrap bool Enable/disable word wrap
.textColor Vector4D Text color
.backgroundColor Vector4D Background color
.drawBorder bool Draw text box border
.hovered bool True if mouse is over the text
.pressed bool True if text is being pressed
Function Returns Description
:destroy() Destroys the object
:setFont() Sets the font to use
:setMaxSize() Sets the max visible size; crops beyond it
:toFront() Moves the Text2D to the top of the z-order
:toBack() Moves the Text2D to the back of the z-order
:setBorderAlignment(int left, int right, int top, int bottom) Sets border alignment, see GUI_ALIGNMENT
:setParent(Image2D image) Parents this Text2D to the given image
:fireOnClick(Function f) Binds function f with a bool indicating press/release
:fireOnHover(Function f) Binds function f with a bool indicating hover/unhover