UIText

UIText - A UI object that displays text

Constructor

new UIText(posopt, sizeopt, textopt, alignopt, fontopt)

Create a UIText object

Parameters:
NameTypeAttributesDefaultDescription
posVector2<optional>
sizeVector2<optional>
textstring<optional>
alignstring<optional>
center
fontstring<optional>
uiSystem.defaultFont

Extends

Members

children

Properties
TypeDescription
Array.<UIObject>

A list of this object's children

color

Properties
TypeDescription
Color

Color of the object

cornerRadius

Properties
TypeDescription
number

Corner radius for rounded rects

disabled

Properties
TypeDescription
boolean

Is this object disabled?

disabledColor

Properties
TypeDescription
Color

Color when disabled

extraTouchSize

Properties
TypeDescription
number

Extra size added to make small buttons easier to touch on mobile devices

font

Properties
TypeDescription
string

Font for this objecct

Overrides

hoverColor

Properties
TypeDescription
Color

Color used when hovering over the object

interactive

Properties
TypeDescription
boolean

Is this element interactive

lineColor

Properties
TypeDescription
Color

Color for line drawing

lineWidth

Properties
TypeDescription
number

Width for line drawing

localPos

Properties
TypeDescription
Vector2

Local position of the object

mouseIsHeld

Properties
TypeDescription
boolean

Is the mouse held on this element (was pressed while over and hasn't been released)

mouseIsOver

Properties
TypeDescription
boolean

Is the mouse over this element

parent

Properties
TypeDescription
UIObject

This object's parent, position is in parent space

pos

Properties
TypeDescription
Vector2

Screen space position of the object

Overrides

size

Properties
TypeDescription
Vector2

Screen space size of the object

Overrides

soundClick

Properties
TypeDescription
Sound

Sound when interactive element is clicked

soundPress

Properties
TypeDescription
Sound

Sound when interactive element is pressed

soundRelease

Properties
TypeDescription
Sound

Sound when interactive element is released

text

Properties
TypeDescription
string

Text for this ui object

Overrides

textColor

Properties
TypeDescription
Color

Color for text

textHeight

Properties
TypeDescription
number

Override for text height

textScale

Properties
TypeDescription
number

Scale text to fit in the object

textWidth

Properties
TypeDescription
number

Override for text width

visible

Properties
TypeDescription
boolean

Should this object be drawn

Methods

addChild(child)

Add a child UIObject to this object

Parameters:
NameTypeDescription
childUIObject

getTextSize() → {Vector2}

Get the size for text with overrides and scale

Returns:
Type: 
Vector2

onChange()

Called when the state of this object changes

onClick()

Called when user clicks on this object

onEnter()

Called when the mouse enters the object

onLeave()

Called when the mouse leaves the object

onPress()

Called when the mouse is pressed while over the object

onRelease()

Called when the mouse is released while over the object

removeChild(child)

Remove a child UIObject from this object

Parameters:
NameTypeDescription
childUIObject

render()

Render the object, called automatically by plugin once each frame

update()

Update the object, called automatically by plugin once each frame

updateInvisible()

Special update when object is not visible