new ValueBar()
A UI element to visually represent a quantifiable value as a proportion of a maximum,
such as health, mana, progress, etc.
- Source:
Extends
- BaseUIElement
Methods
(protected) _drawSelf(context, engine)
Specific drawing logic for the ValueBar.
Called by BaseUIElement.render after visibility and context checks.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D | The rendering context. |
engine |
- Source:
setPercentage(percentage)
Sets the fill level of the bar based on a percentage.
Parameters:
Name | Type | Description |
---|---|---|
percentage |
number | The percentage (0 to 100) to fill the bar. |
- Source:
setValue(current, maxopt)
Sets the current and maximum values of the bar.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
current |
number | The new current value. | |
max |
number |
<optional> |
The new maximum value. If undefined, maxValue remains unchanged. |
- Source:
update(deltaTime, engine, mousePosopt)
Update logic for the ValueBar.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
deltaTime |
number | The time elapsed since the last frame. | |
engine |
|||
mousePos |
Object |
<optional> |
Current canvas-relative mouse position. |
- Source: