Page 2 of 2

Re: rounded rectangle

Posted: Mon Mar 25, 2013 9:07 am
by anorak
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)

Re: rounded rectangle

Posted: Mon Mar 25, 2013 12:42 pm
by slime
love.graphics.polygon's "fill" draw mode can only render convex polygons.

https://bitbucket.org/rude/love/issue/8 ... e-polygons

Re: rounded rectangle

Posted: Tue Mar 26, 2013 8:04 pm
by anorak
slime wrote:love.graphics.polygon's "fill" draw mode can only render convex polygons.

https://bitbucket.org/rude/love/issue/8 ... e-polygons
Right you are! Good to know. I didn't notice that in the docs earlier.

Re: rounded rectangle

Posted: Wed Mar 27, 2013 1:22 am
by Kyle
Xgoff wrote:
kikito wrote:Back in my time, we had to calculate segment coordinates with our bare trigonometrics functions.
well, you still do if you don't want those extra two lines connecting the center point in line draw mode
I've published my code for doing that :D

http://love2d.org/forums/viewtopic.php?f=4&t=30528