lcd.drawFilledRectangle¶
since 1.1.0
Draw a filled rectangle.
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
x |
number | yes | X coordinate |
y |
number | yes | Y coordinate |
w |
number | yes | rectangle width |
h |
number | yes | rectangle height |
Returns¶
Nothing.
Examples¶
-- a horizontal bar: track + fill
local TRACK, FILL = lcd.GREY(60), lcd.RGB(40, 190, 80)
local function drawBar(x, y, w, h, percent)
lcd.color(TRACK)
lcd.drawFilledRectangle(x, y, w, h)
lcd.color(FILL)
lcd.drawFilledRectangle(x, y, math.floor(w * percent / 100), h)
end
See the battery gauge recipe for a complete widget.
Used in¶
Real-world usage¶
Called 354 times across 12 open-source Ethos Lua projects. A few short excerpts: