Garry's Mod Wiki

surface.DrawCircle

  surface.DrawCircle( number originX, number originY, number radius, number r, number g, number b, number a = 255 )

Description

Draws a hollow circle, made of lines. For a filled circle, see examples for surface.DrawPoly.

This is a rendering function that requires a 2d rendering context.

This means that it will only work in 2d Rendering Hooks.

Arguments

1 number originX
The center x integer coordinate.
2 number originY
The center y integer coordinate.
3 number radius
The radius of the circle.
4 number r
The red value of the color to draw the circle with, or a Color.
5 number g
The green value of the color to draw the circle with. Unused if a Color was given.
6 number b
The blue value of the color to draw the circle with. Unused if a Color was given.
7 number a = 255
The alpha value of the color to draw the circle with. Unused if a Color was given.

Example

Example usage. Draws an orange circle at position 500, 500 with a varying/animated radius of 50 to 150.

hook.Add( "HUDPaint", "DrawCircleExample", function() surface.DrawCircle( 500, 500, 100 + math.sin( CurTime() ) * 50, Color( 255, 120, 0 ) ) end )