rounded rectangle

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
anorak
Prole
Posts: 11
Joined: Mon Mar 25, 2013 8:10 am

Re: rounded rectangle

Post 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)
User avatar
slime
Solid Snayke
Posts: 3163
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: rounded rectangle

Post by slime »

love.graphics.polygon's "fill" draw mode can only render convex polygons.

https://bitbucket.org/rude/love/issue/8 ... e-polygons
User avatar
anorak
Prole
Posts: 11
Joined: Mon Mar 25, 2013 8:10 am

Re: rounded rectangle

Post 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.
Kyle
Party member
Posts: 146
Joined: Sat Mar 16, 2013 9:46 pm

Re: rounded rectangle

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests