 # Drawing a circle that's filled in.

I used this code:
surface.DrawCircle(ScrW()*0.9, ScrH()*0.9, 100, Color(255,255,255,255))
to draw a circle but all I see is the white outline of the circle. How do I fill in the circle completely white?

I’ve yet to find a way.
Guess you could use the surface poly function.

use the drawcircle function like a thousan times and make it 1 unit smaller each time so that its filled in XD

Yeah, because that’s obviously a good idea…

[lua]local radius = 100
local maxradius = radius
local saferadius = (maxradius - 1)
for i=1, saferadius do
radius = radius - 1
surface.DrawCircle(ScrW()*0.9, ScrH()*0.9, radius, Color(255,255,255,255))
end[/lua]

Will likely lag, you have been warned.

[lua]
local radius = 100
local quality = 360
local circle = {}
for i=1,quality do
circle* = {}
circle*.x = math.sin(i/quality360)radius
circle
.y = math.cos(i/quality
360)*radius
end
–In draw hook or whatever
surface.DrawPoly(circle)
[/lua]

Even I think op doesn’t deserve this.

Above code is wrong.

[lua]
local sin,cos,rad = math.sin,math.cos,math.rad;
function surface.CreatePoly(x,y,radius,quality)
local circle = {};
for i=1,quality do
circle* = {};
circle*.x = x + cos(rad(i360)/quality)radius;
circle
.y = y + sin(rad(i
360)/quality)*radius;
end
return circle;
end
[/lua]

lua uses radiance not degrees.

you could make a crappy one with draw.RoundedBox()

Best way is to make a texture that is a circle. You could make it white so you can change the color with lua.

I did some tests… when you have static circle you should a poly otherwise a texture.

Also what the fuck we are doing here, OP is banned and a total asshole.

Bump- I still need help.

You’ve already been answered:

[lua]
local sin,cos,rad = math.sin,math.cos,math.rad;
function surface.CreatePoly(x,y,radius,quality)
local circle = {};
for i=1,quality do
circle* = {};
circle*.x = x + cos(rad(i360)/quality)radius;
circle
.y = y + sin(rad(i
360)/quality)*radius;
end
return circle;
end
[/lua]

And then in a draw hook:

[lua]
surface.DrawPoly(circle)
[/lua]

‘circle’ obviously already being defined by surface.CreatePoly(x, y, 100, 360)

I’m not Cubar.

[editline]25th December 2010[/editline]

You shittin’ me bro? You reposted broken code.

Code works fine, you must be Cubar if you can’t get it to work.

Cubar was pro at Lua and he was a god. Do not disrespect him.

:cawg: at post above mine’s.

I tried that method the other day, and it works fine.

-snip- FP Lagged.

he probably doesn’t know to put it in a draw hook

No, I don’t. I put it in a HUDPaint hook. Was that wrong? What’s a draw hook?