Constructor
new UIObject(posopt, sizeopt)
Create a UIObject
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
pos | Vector2 | <optional> | vec2() | |
size | Vector2 | <optional> | vec2(1) |
- Source
Members
activeColor
Properties| Type | Description |
|---|---|
| Color | Color of the object when active, uses hoverColor if undefined |
- Source
canBeHover
Properties| Type | Description |
|---|---|
| boolean | True if this can be a hover object |
- Source
children
Properties| Type | Description |
|---|---|
| Array.<UIObject> | A list of this object's children |
- Source
color
Properties| Type | Description |
|---|---|
| Color | Color of the object |
- Source
cornerRadius
Properties| Type | Description |
|---|---|
| number | Corner radius for rounded rects |
- Source
disabled
Properties| Type | Description |
|---|---|
| boolean | Is this object disabled? |
- Source
disabledColor
Properties| Type | Description |
|---|---|
| Color | Color when disabled |
- Source
dragActivate
Properties| Type | Description |
|---|---|
| boolean | Activate when dragged over with mouse held down |
- Source
extraTouchSize
Properties| Type | Description |
|---|---|
| number | Added size to make small buttons easier to touch on mobile devices |
- Source
font
Properties| Type | Description |
|---|---|
| string | Font for this objecct |
- Source
fontStyle
Properties| Type | Description |
|---|---|
| string | Font style for this object or undefined |
- Source
gradientColor
Properties| Type | Description |
|---|---|
| Color | Uses a gradient fill combined with color |
- Source
hoverColor
Properties| Type | Description |
|---|---|
| Color | Color used when hovering over the object |
- Source
interactive
Properties| Type | Description |
|---|---|
| boolean | Is this element interactive |
- Source
lineColor
Properties| Type | Description |
|---|---|
| Color | Color for line drawing |
- Source
lineWidth
Properties| Type | Description |
|---|---|
| number | Width for line drawing |
- Source
localPos
Properties| Type | Description |
|---|---|
| Vector2 | Local position of the object |
- Source
navigationAutoSelect
Properties| Type | Description |
|---|---|
| boolean | Should this be auto selected by navigation? Must also have valid navigation index. |
- Source
navigationIndex
Properties| Type | Description |
|---|---|
| number | Optional navigation order index, lower values are selected first |
- Source
parent
Properties| Type | Description |
|---|---|
| UIObject | This object's parent, position is in parent space |
- Source
pos
Properties| Type | Description |
|---|---|
| Vector2 | Screen space position of the object |
- Source
shadowBlur
Properties| Type | Description |
|---|---|
| number | Size of shadow blur |
- Source
shadowColor
Properties| Type | Description |
|---|---|
| Color | Color for shadow, undefined if no shadow |
- Source
shadowOffset
Properties| Type | Description |
|---|---|
| Vector2 | Offset of shadow blur |
- Source
size
Properties| Type | Description |
|---|---|
| Vector2 | Screen space size of the object |
- Source
soundClick
Properties| Type | Description |
|---|---|
| Sound | Sound when interactive element is clicked |
- Source
soundPress
Properties| Type | Description |
|---|---|
| Sound | Sound when interactive element is pressed |
- Source
soundRelease
Properties| Type | Description |
|---|---|
| Sound | Sound when interactive element is released |
- Source
text
Properties| Type | Description |
|---|---|
| string | Text for this ui object |
- Source
textColor
Properties| Type | Description |
|---|---|
| Color | Color for text |
- Source
textFitScale
Properties| Type | Description |
|---|---|
| number | Scale text to fit in the object |
- Source
textHeight
Properties| Type | Description |
|---|---|
| number | Override for text height |
- Source
textLineColor
Properties| Type | Description |
|---|---|
| number | Color for text line drawing |
- Source
textLineWidth
Properties| Type | Description |
|---|---|
| number | Width for text line drawing |
- Source
textShadow
Properties| Type | Description |
|---|---|
| Vector2 | How much to offset the text shadow or undefined |
- Source
textWidth
Properties| Type | Description |
|---|---|
| number | Override for text width |
- Source
visible
Properties| Type | Description |
|---|---|
| boolean | Should this object be drawn |
- Source
Methods
addChild(child) → {UIObject}
Add a child UIObject to this object, returns child for chaining
| Name | Type | Description |
|---|---|---|
child | UIObject |
- Source
The child object added
- Type:
- UIObject
destroy()
Destroy this object, destroy its children, detach its parent, and mark it for removal
- Source
getTextSize() → {Vector2}
Get the size for text with overrides and scale
- Source
- Type:
- Vector2
isActiveObject() → {boolean}
- Source
- Is the mouse held onto this element
- Type:
- boolean
isHoverObject() → {boolean}
- Source
- Is the mouse hovering over this element
- Type:
- boolean
isInteractive() → {boolean}
- Source
- Can it be interacted with
- Type:
- boolean
isMouseOverlapping() → {boolean}
Check if the mouse is overlapping a box in screen space
- Source
- True if overlapping
- Type:
- boolean
isNavigationObject() → {boolean}
- Source
- Is the gamepad or keyboard navigation object
- Type:
- boolean
navigatePressed()
Called when the navigation button is pressed on this object
- Source
onChange()
Called when the state of this object changes
- Source
onClick()
Called when user clicks on this object
- Source
onEnter()
Called when the mouse enters the object
- Source
onLeave()
Called when the mouse leaves the object
- Source
onPress()
Called when the mouse is pressed while over the object
- Source
onRelease()
Called when the mouse is released while over the object
- Source
onRender()
Called each frame before object renders
- Source
onUpdate()
Called each frame before object updates
- Source
removeChild(child)
Remove a child UIObject from this object
| Name | Type | Description |
|---|---|---|
child | UIObject |
- Source
render()
Render the object, called automatically by plugin once each frame
- Source
renderDebug(visible)
Called if uiDebug is enabled
| Name | Type | Default | Description |
|---|---|---|---|
visible | boolean | true |
- Source
toString() → {string}
Returns string containing info about this object for debugging
- Source
- Type:
- string
update()
Update the object, called automatically by plugin once each frame
- Source