UIBaseElement
class UIBaseElement extends Container
This is a basic clickable and draggable container which you can use in your game UI. Use this for example if you want to display a panel that contains text, images or other UI elements.
Constructor
new UIBaseElement(x: number, y: number, w: number, h: number) → {}
Name | Type | Description |
---|---|---|
x | number |
The x position of the container |
y | number |
The y position of the container |
w | number |
width of the container |
h | number |
height of the container |
Summary
Properties from UIBaseElement
boolean |
|
number |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
Methods from UIBaseElement
boolean |
|
|
|
|
|
|
|
|
|
boolean |
|
Properties inherited from Container
boolean |
|
boolean |
|
Color |
|
boolean |
|
boolean |
|
boolean |
|
string |
|
Properties inherited from Renderable
number |
|
boolean |
|
Container | Entity |
|
ObservableVector2d |
|
boolean |
|
string |
|
Body |
|
Matrix2d |
|
number |
|
string |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
Rect | RoundRect | Polygon | Line | Ellipse |
|
string |
|
Function |
|
Application |
|
ObservableVector3d |
|
GLShader |
|
Color |
|
boolean |
|
Properties inherited from Rect
Methods inherited from Container
Methods inherited from Renderable
Methods inherited from Rect
Rect |
|
Rect |
|
boolean |
|
Rect |
|
boolean |
|
boolean |
|
boolean |
|
Rect |
|
Rect |
|
Polygon |
|
Rect |
|
Methods inherited from Polygon
Array<number> |
|
boolean |
|
Polygon |
|
Polygon |
|
|
|
Polygon |
|
Polygon |
|
Polygon |
|
Public Properties
floating: boolean = true
boolean
UI base elements use screen coordinates by default (Note: any child elements added to a UIBaseElement should have their floating property to false)
holdThreshold: number = 250
number
Tap and hold threshold timeout in ms
released: boolean = false
boolean
false if the pointer is down, or true when the pointer status is up
Public Methods
onClick(event: Pointer) → {boolean}
function called when the object is pressed (to be extended)
Name | Type | Description |
---|---|---|
event | Pointer |
the event object |
Type | Description |
---|---|
boolean |
return false if we need to stop propagating the event |
onHold() → {}
function called when the object is pressed and held
to be extended
onMove(event: Pointer) → {}
function called when the pointer is moved over the object
Name | Type | Description |
---|---|---|
event | Pointer |
the event object |
onOut(event: Pointer) → {}
function called when the pointer is leaving the object area
Name | Type | Description |
---|---|---|
event | Pointer |
the event object |
onOver(event: Pointer) → {}
function called when the pointer is over the object
Name | Type | Description |
---|---|---|
event | Pointer |
the event object |
onRelease() → {boolean}
function called when the object is pressed and released (to be extended)
Type | Description |
---|---|
boolean |
return false if we need to stop propagating the event |