Skip to content

Commit

Permalink
Merge pull request vrld#65 from tesselode/master
Browse files Browse the repository at this point in the history
allow passing segments argument to CircleShape:draw()
  • Loading branch information
vrld authored Sep 7, 2021
2 parents f0aa1bf + f969ac2 commit 9a05518
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/Shapes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ Built-in Shapes

.. class:: CircleShape

.. function:: CircleShape:draw(mode, segments)

:param DrawMode mode: How to draw the shape. Either 'line' or 'fill'.
:param number segments: The number of segments to draw the circle with.

Draw the circle shape either filled or as an outline and with the specified number of segments.

.. class:: PointShape

.. function:: newPolygonShape(...)
Expand Down
3 changes: 2 additions & 1 deletion shapes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ function ConcavePolygonShape:draw(mode, wireframe)
end

function CircleShape:draw(mode, segments)
love.graphics.circle(mode or 'line', self:outcircle())
local x, y, r = self:outcircle()
love.graphics.circle(mode or 'line', x, y, r, segments)
end

function PointShape:draw()
Expand Down

0 comments on commit 9a05518

Please sign in to comment.