I use something like this
Code: Select all
function generate_circle(mode,x, y, r, w, n, r1, r2)
local cp = {}
if r1 == nil then r1 = 0 end
if r2 == nil then r2 = 2*math.pi end
local t = (r2-r1)/n
if mode == "inner" then
r = r-w/2
elseif mode == "outer" then
r= r+w/2
end
for i=0,n,1 do
cp[4*i + 1] = x + (r-w/2)*math.cos(r1+i*t)
cp[4*i + 2] = y + (r-w/2)*math.sin(r1+i*t)
cp[4*i + 3] = x + (r+w/2)*math.cos(r1+i*t)
cp[4*i + 4] = y + (r+w/2)*math.sin(r1+i*t)
end
return cp
end
function draw_quadstrip(mode, q)
for i=1,#q-4,4 do
love.graphics.quad( mode, q[i], q[i+1], q[i+2], q[i+3],
q[i+6], q[i+7], q[i+4], q[i+5] )
end
end
x, y : center
r : radius
w : width
n : segments
r1 : start angle(radian)
r2 : end angle(radian)
circle = generate_circle(...)
draw_quadstrip("fill", circle)