new Checkbox()
An interactive UI element that represents a boolean state (checked/unchecked).
- Source:
Extends
- BaseUIElement
Methods
(protected) _drawSelf(context, engine)
Specific drawing logic for the Checkbox.
Called by BaseUIElement.render after visibility and context checks.
Parameters:
Name | Type | Description |
---|---|---|
context |
CanvasRenderingContext2D | The rendering context. |
engine |
- Source:
setChecked(checked, triggerCallbackopt)
Sets the checked state of the checkbox.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
checked |
boolean | The new checked state. | ||
triggerCallback |
boolean |
<optional> |
false | Whether to trigger the onClick callback. |
- Source:
toggle()
Toggles the checked state of the checkbox.
Also triggers the onClick callback.
- Source:
update(deltaTime, engine, mousePos)
Updates the checkbox's state based on mouse input.
Parameters:
Name | Type | Description |
---|---|---|
deltaTime |
number | The time elapsed since the last frame. |
engine |
||
mousePos |
Object | Current canvas-relative mouse position. |
- Source: