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
[QUOTE=c-unit;26859237]use the drawcircle function like a thousan times and make it 1 unit smaller each time so that its filled in XD[/QUOTE]
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[i] = {}
circle[i].x = math.sin(i/quality*360)*radius
circle[i].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.
[QUOTE=whosdr;26859745][lua]
local radius = 100
local quality = 360
local circle = {}
for i=1,quality do
circle[i] = {}
circle[i].x = math.sin(i/quality*360)*radius
circle[i].y = math.cos(i/quality*360)*radius
end
--In draw hook or whatever
surface.DrawPoly(circle)
[/lua][/QUOTE]
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[i] = {};
circle[i].x = x + cos(rad(i*360)/quality)*radius;
circle[i].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.
[QUOTE=CowThing;26866984]Best way is to make a texture that is a circle. You could make it white so you can change the color with lua.[/QUOTE]
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.
I'm not Cubar.
[editline]25th December 2010[/editline]
[QUOTE=iRzilla;26960796]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[i] = {};
circle[i].x = x + cos(rad(i*360)/quality)*radius;
circle[i].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)[/QUOTE]
You shittin' me bro? You reposted broken code.
[QUOTE=iRzilla;26962787]Code works fine, you must be Cubar if you can't get it to work.[/QUOTE]
Cubar was pro at Lua and he was a god. Do not disrespect him.
:cawg: at post above mine's.
[QUOTE=Lemmiwinks!;26962415]
You shittin' me bro? You reposted broken code.[/QUOTE]
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
[QUOTE=TGiFallen;26971716]he probably doesn't know to put it in a draw hook[/QUOTE]
No, I don't. I put it in a HUDPaint hook. Was that wrong? What's a draw hook?
[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[i] = {};
circle[i].x = x + cos(rad(i*360)/quality)*radius;
circle[i].y = y + sin(rad(i*360)/quality)*radius;
end
return circle;
end
function DrawingTests()
surface.DrawPoly(circle)
end
hook.Add("HUDPaint", "DrawingTests", DrawingTests)[/lua]
[editline]26th December 2010[/editline]
[QUOTE=TGiFallen;26971716]he probably doesn't know to put it in a draw hook[/QUOTE]
Oh, it's you: [img]http://oi51.tinypic.com/2dkac04.jpg[/img]
[QUOTE=iRzilla;26983575]circle = surface.CreatePoly(x, y, 100, 360)
Is the error 'circle is nil' not enough?[/QUOTE]
what's a nil?
NILL is the equivelant of placing a black hole inside another black hole.
[QUOTE=Zephilinox;26983777]NILL is the equivelant of placing a black hole inside another black hole.[/QUOTE]
So basically NILL is an extremely strong gravitational pull?
[QUOTE=Lemmiwinks!;26983815]So basically NILL is an extremely strong gravitational pull?[/QUOTE]
You can't know that until it's actually happened, and we've witnessed it, basically it just means "non-existant".
[QUOTE=Lemmiwinks!;26983491][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[i] = {};
circle[i].x = x + cos(rad(i*360)/quality)*radius;
circle[i].y = y + sin(rad(i*360)/quality)*radius;
end
return circle;
end
function DrawingTests()
surface.DrawPoly(circle)
end
hook.Add("HUDPaint", "DrawingTests", DrawingTests)[/lua]
[editline]26th December 2010[/editline]
Oh, it's you: [img_thumb]http://oi51.tinypic.com/2dkac04.jpg[/img_thumb][/QUOTE]
you amuse me
[QUOTE=Zephilinox;26983913]You can't know that until it's actually happened, and we've witnessed it, basically it just means "non-existant".[/QUOTE]
Nil breaks the laws of the universe.
[QUOTE=Lemmiwinks!;26983491][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[i] = {};
circle[i].x = x + cos(rad(i*360)/quality)*radius;
circle[i].y = y + sin(rad(i*360)/quality)*radius;
end
return circle;
end
function DrawingTests()
surface.DrawPoly(circle)
end
hook.Add("HUDPaint", "DrawingTests", DrawingTests)[/lua]
[editline]26th December 2010[/editline]
Oh, it's you: [img_thumb]http://oi51.tinypic.com/2dkac04.jpg[/img_thumb][/QUOTE]
Its funny how you took my code and totally used it wrong.
[QUOTE=Zephilinox;26983913]You can't know that until it's actually happened, and we've witnessed it, basically it just means "non-existant".[/QUOTE]
The black hole only gets stronger according to the most respected theory.
...What happens if you divide by zero in GLua, I bet garry added something funny
I bet he didn't and it errors just like in real life
[QUOTE=Andriko1;26990070]...What happens if you divide by zero in GLua, I bet garry added something funny[/QUOTE]
] lua_run_cl print(1/0)
1.#INF
:(
Sorry, you need to Log In to post a reply to this thread.