Constructor
new UISystemPlugin(contextopt)
Create the global UI system object
Name | Type | Attributes | Description |
---|---|---|---|
context | CanvasRenderingContext2D | <optional> |
- Source
// create the ui plugin object
new UISystemPlugin;
Members
defaultButtonColor
PropertiesType | Description |
---|---|
Color | Default button color for UI elements |
- Source
defaultColor
PropertiesType | Description |
---|---|
Color | Default fill color for UI elements |
- Source
defaultCornerRadius
PropertiesType | Description |
---|---|
number | Default rounded rect corner radius for UI elements |
- Source
defaultDisabledColor
PropertiesType | Description |
---|---|
Color | Default color for disabled UI elements |
- Source
defaultFont
PropertiesType | Description |
---|---|
string | Default font for UI elements |
- Source
defaultHoverColor
PropertiesType | Description |
---|---|
Color | Default hover color for UI elements |
- Source
defaultLineColor
PropertiesType | Description |
---|---|
Color | Default outline color for UI elements |
- Source
defaultLineWidth
PropertiesType | Description |
---|---|
number | Default line width for UI elements |
- Source
defaultSoundClick
PropertiesType | Description |
---|---|
Sound | Default sound when interactive UI element is clicked |
- Source
defaultSoundPress
PropertiesType | Description |
---|---|
Sound | Default sound when interactive UI element is pressed |
- Source
defaultSoundRelease
PropertiesType | Description |
---|---|
Sound | Default sound when interactive UI element is released |
- Source
defaultTextColor
PropertiesType | Description |
---|---|
Color | Default text color for UI elements |
- Source
defaultTextScale
PropertiesType | Description |
---|---|
number | Default scale to use for fitting text to object |
- Source
uiContext
PropertiesType | Description |
---|---|
CanvasRenderingContext2D | | Context to render UI elements to |
- Source
uiObjects
PropertiesType | Description |
---|---|
Array.<UIObject> | List of all UI elements |
- Source
Methods
drawLine(posA, posB, lineWidthopt, lineColoropt)
Draw a line to the UI context
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
posA | Vector2 | |||
posB | Vector2 | |||
lineWidth | number | <optional> | uiSystem.defaultLineWidth | |
lineColor | Color | <optional> | uiSystem.defaultLineColor |
- Source
drawRect(pos, size, coloropt, lineWidthopt, lineColoropt, cornerRadiusopt)
Draw a rectangle to the UI context
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos | Vector2 | |||
size | Vector2 | |||
color | Color | <optional> | uiSystem.defaultColor | |
lineWidth | number | <optional> | uiSystem.defaultLineWidth | |
lineColor | Color | <optional> | uiSystem.defaultLineColor | |
cornerRadius | number | <optional> | uiSystem.defaultCornerRadius |
- Source
drawText(text, pos, size, coloropt, lineWidthopt, lineColoropt, alignopt, fontopt, applyMaxWidthopt)
Draw text to the UI context
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
text | string | |||
pos | Vector2 | |||
size | Vector2 | |||
color | Color | <optional> | uiSystem.defaultColor | |
lineWidth | number | <optional> | uiSystem.defaultLineWidth | |
lineColor | Color | <optional> | uiSystem.defaultLineColor | |
align | string | <optional> | center | |
font | string | <optional> | uiSystem.defaultFont | |
applyMaxWidth | boolean | <optional> | true |
- Source
drawTile(pos, size, tileInfo, coloropt, angleopt, mirroropt)
Draw a tile to the UI context
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos | Vector2 | |||
size | Vector2 | |||
tileInfo | TileInfo | |||
color | Color | <optional> | uiSystem.defaultColor | |
angle | number | <optional> | 0 | |
mirror | boolean | <optional> | false |
- Source