drawPie
Draws a filled sector of a circle (a “pie slice”). This function can also draw a full circle if the angle difference exceeds
Signature
Section titled “Signature”ui.drawPie(center, radius, angleFrom, angleTo, color, image)Description
Section titled “Description”This function renders a convex shape from the center point out to the arc defined by the start and end angles.
- If
angleTois less thanangleFrom, they are swapped automatically. - If the difference between angles is greater than
math.tau(), it efficiently renders a full ui.drawCircleFilledinstead. - If an
imageis provided, it appliesui.beginTextureShadeto mask the texture within the pie shape.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
center | vec2 | Yes | - | Screen coordinates for the center of the circle. |
radius | number | Yes | - | The radius of the circle in pixels. |
angleFrom | number | Yes | - | Starting angle in radians. |
angleTo | number | Yes | - | Ending angle in radians. |
color | rgbm | No | rgbm.colors.white | The fill color. |
image | ui.ImageSource | No | nil | An optional texture (filename, ui.MediaPlayer, etc.) to draw inside the shape. |
Return Values
Section titled “Return Values”- None
Examples
Section titled “Examples”Draw a yellow circle with a “mouth” open (missing sector).
local center = vec2(100, 100)local radius = 50local yellow = rgbm(1, 1, 0, 1)
-- angles in radians-- 0.2 rad to 6.08 rad leaves a slice openui.drawPie(center, radius, 0.2, math.tau - 0.2, yellow)Draw a semi-transparent circular radar/map using a texture.
local center = vec2(200, 100)local radius = 80local tint = rgbm(1, 1, 1, 0.8)
-- draw full circle (0 to 2pi) masked with a map textureui.drawPie(center, radius, 0, math.tau, tint, "map_texture.png")