LittleJS User Interface Plugin
- Nested Menus
- Text
- Buttons
- Checkboxes
- Images
- Source
Members
(static) uiContext :CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D
Context to render UI elements to
Type:
- CanvasRenderingContext2D |
OffscreenCanvasRenderingContext2D
- Source
(static) uiDefaultButtonColor :Color
Default button color for UI elements
Type:
- Source
(static) uiDefaultColor :Color
Default fill color for UI elements
Type:
- Source
(static) uiDefaultFont :string
Default font for UI elements
Type:
- string
- Source
(static) uiDefaultHoverColor :Color
Default hover color for UI elements
Type:
- Source
(static) uiDefaultLineColor :Color
Default outline color for UI elements
Type:
- Source
(static) uiDefaultLineWidth :number
Default line width for UI elements
Type:
- number
- Source
(static) uiDefaultTextColor :Color
Default text color for UI elements
Type:
- Source
(static) uiObjects :Array.<UIObject>
List of all UI elements
Type:
- Array.<UIObject>
- Source
Methods
(static) drawUILine(posA, posB, lineWidthopt, lineColoropt)
Draw a line to the UI context
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
posA | Vector2 | |||
posB | Vector2 | |||
lineWidth | number | <optional> | uiDefaultLineWidth | |
lineColor | Color | <optional> | uiDefaultLineColor |
- Source
(static) drawUIRect(pos, size, coloropt, lineWidthopt, lineColoropt)
Draw a rectangle to the UI context
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos | Vector2 | |||
size | Vector2 | |||
color | Color | <optional> | uiDefaultColor | |
lineWidth | number | <optional> | uiDefaultLineWidth | |
lineColor | Color | <optional> | uiDefaultLineColor |
- Source
(static) drawUIText(text, pos, size, coloropt, lineWidthopt, lineColoropt, alignopt, fontopt)
Draw text to the UI context
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
text | string | |||
pos | Vector2 | |||
size | Vector2 | |||
color | Color | <optional> | uiDefaultColor | |
lineWidth | number | <optional> | uiDefaultLineWidth | |
lineColor | Color | <optional> | uiDefaultLineColor | |
align | string | <optional> | center | |
font | string | <optional> | uiDefaultFont |
- Source
(static) drawUITile(pos, size, tileInfo, coloropt, angleopt, mirroropt)
Draw a tile to the UI context
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos | Vector2 | |||
size | Vector2 | |||
tileInfo | TileInfo | |||
color | Color | <optional> | uiDefaultColor | |
angle | number | <optional> | 0 | |
mirror | boolean | <optional> | false |
- Source
(static) initUISystem(contextopt)
Set up the UI system, typically called in gameInit
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
context | CanvasRenderingContext2D | | <optional> | overlayContext |
- Source