M MY Multiplayer: Wiki
Side
Kind

dxDrawCircle

Client

Draws a filled circle, or a slice of one, on the screen for one frame.

bool dxDrawCircle(float x, y, float radius [, float startAngle = 0, float stopAngle = 360, color color = tocolor(255, 255, 255), color centerColor = color, int segments = 32, float ratio = 1, bool postGUI = false])

Parameters

NameTypeDescription
x, yfloatCentre, in pixels. A vec2 also works.
radiusfloatRadius in pixels.
startAnglefloatStart angle in degrees. 0 points right and the angle grows clockwise.default 0
stopAnglefloatStop angle in degrees. The two angles are swapped when reversed, and the slice covers at most 360°.default 360
colorcolorEdge colour, a tocolor value.default tocolor(255, 255, 255)
centerColorcolorCentre colour, blended out to the edge.default color
segmentsintNumber of segments, from 3 to 1024.default 32
ratiofloatWidth over height, for ellipses. Above 0 and up to 100.default 1
postGUIboolDraw on top of the interface.default false

Returns

true once the drawing is queued. false when segments is outside 3 to 1024, ratio outside 0 to 100, radius is not positive or the angles are equal.

Example

local sx, sy = getScreenSize()

addEventHandler("onClientRender", root, function()
    local health = getElementHealth(localPlayer)
    dxDrawCircle(sx - 60, sy - 60, 40, 0, 360 * health / 100, tocolor(200, 40, 40, 220))
end)

See also