LCDElement
- supers: Element
When editing code for a LCDElement, the Grid editor automatically types self, element, and ele as LCDElement - so you can call these functions directly:
self:draw_pixel() -- on the current element
element[1]:draw_pixel() -- on a specific element from the array
LCDElement:draw_swap
Updates the screen with the contents of the background buffer.
LCDElement:draw_swap()
LCDElement:draw_pixel
Draws a pixel at (x, y) with the specified color.
LCDElement:draw_pixel(
x: integer,
y: integer,
color: integer[]
)
x — X coordinatey — Y coordinatecolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_line
Draws a line between two points.
LCDElement:draw_line(
x1: integer,
y1: integer,
x2: integer,
y2: integer,
color: integer[]
)
x1 — Start X coordinatey1 — Start Y coordinatex2 — End X coordinatey2 — End Y coordinatecolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_rectangle
Draws a rectangle outline between two corner points.
LCDElement:draw_rectangle(
x1: integer,
y1: integer,
x2: integer,
y2: integer,
color: integer[]
)
x1 — Top-left X coordinatey1 — Top-left Y coordinatex2 — Bottom-right X coordinatey2 — Bottom-right Y coordinatecolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_rectangle_filled
Draws a filled rectangle between two corner points.
LCDElement:draw_rectangle_filled(
x1: integer,
y1: integer,
x2: integer,
y2: integer,
color: integer[]
)
x1 — Top-left X coordinatey1 — Top-left Y coordinatex2 — Bottom-right X coordinatey2 — Bottom-right Y coordinatecolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_rectangle_rounded
Draws a rounded rectangle outline between two corner points.
LCDElement:draw_rectangle_rounded(
x1: integer,
y1: integer,
x2: integer,
y2: integer,
radius: integer,
color: integer[]
)
x1 — Top-left X coordinatey1 — Top-left Y coordinatex2 — Bottom-right X coordinatey2 — Bottom-right Y coordinateradius — Corner radius in pixelscolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_rectangle_rounded_filled
Draws a filled rounded rectangle between two corner points.
LCDElement:draw_rectangle_rounded_filled(
x1: integer,
y1: integer,
x2: integer,
y2: integer,
radius: integer,
color: integer[]
)
x1 — Top-left X coordinatey1 — Top-left Y coordinatex2 — Bottom-right X coordinatey2 — Bottom-right Y coordinateradius — Corner radius in pixelscolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_polygon
Draws a polygon outline using coordinate arrays.
LCDElement:draw_polygon(
xs: integer[],
ys: integer[],
color: integer[]
)
xs — Array of X coordinates {x1, x2, x3, ...}ys — Array of Y coordinates {y1, y2, y3, ...}color — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_polygon_filled
Draws a filled polygon using coordinate arrays.
LCDElement:draw_polygon_filled(
xs: integer[],
ys: integer[],
color: integer[]
)
xs — Array of X coordinates {x1, x2, x3, ...}ys — Array of Y coordinates {y1, y2, y3, ...}color — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_text
Draws text at the specified position.
LCDElement:draw_text(
text: string,
x: integer,
y: integer,
size: integer,
color: integer[]
)
text — Text to drawx — X coordinatey — Y coordinatesize — Font sizecolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_text_fast
Draws text at the specified position using fast rendering.
LCDElement:draw_text_fast(
text: string,
x: integer,
y: integer,
size: integer,
color: integer[]
)
text — Text to drawx — X coordinatey — Y coordinatesize — Font sizecolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_area_filled
Fills an area with a solid color (no alpha blending).
LCDElement:draw_area_filled(
x1: integer,
y1: integer,
x2: integer,
y2: integer,
color: integer[]
)
x1 — Top-left X coordinatey1 — Top-left Y coordinatex2 — Bottom-right X coordinatey2 — Bottom-right Y coordinatecolor — RGB color as {r, g, b} with 8-bit channels (0–255)LCDElement:draw_demo
Draws the n-th iteration of a built-in demo animation.
LCDElement:draw_demo(n: integer)
n — Demo iteration numberLCDElement:get_render_time
Returns the time spent rendering between the last two swaps, in microseconds.
LCDElement:get_render_time(): integer
microseconds — Render timeLCDElement:screen_index
Returns the screen index used by low-level global GUI APIs.
LCDElement:screen_index(): integer
screen_index — Screen index for use with gui_draw_* functionsLCDElement:screen_width
Returns the screen width in pixels.
LCDElement:screen_width(): integer
width — Screen widthLCDElement:screen_height
Returns the screen height in pixels.
LCDElement:screen_height(): integer
height — Screen height