Here's another function for rounded rects. It's only 18 lines, so if you like shorter functions, here you go.
I noticed Love's (0.8.0) polygon-drawing algorithm seems a little buggy, and this may be affecting some output of the rounded rect function. For example, run the line at the bottom to see an unexpected result.
https://gist.github.com/tylerneylon/5235809
An example of weird polygon drawing (at least in 0.8.0):
love.graphics.polygon('fill', 100, 100, 500, 100, 500, 400, 400, 400, 400, 200, 200, 200)
rounded rectangle
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- slime
- Solid Snayke
- Posts: 3163
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: rounded rectangle
love.graphics.polygon's "fill" draw mode can only render convex polygons.
https://bitbucket.org/rude/love/issue/8 ... e-polygons
https://bitbucket.org/rude/love/issue/8 ... e-polygons
Re: rounded rectangle
Right you are! Good to know. I didn't notice that in the docs earlier.slime wrote:love.graphics.polygon's "fill" draw mode can only render convex polygons.
https://bitbucket.org/rude/love/issue/8 ... e-polygons
Re: rounded rectangle
I've published my code for doing thatXgoff wrote:well, you still do if you don't want those extra two lines connecting the center point in line draw modekikito wrote:Back in my time, we had to calculate segment coordinates with our bare trigonometrics functions.
http://love2d.org/forums/viewtopic.php?f=4&t=30528
Who is online
Users browsing this forum: No registered users and 4 guests