Skip to main content
edited tags
Link
user1430
user1430
Tweeted twitter.com/#!/StackGameDev/status/454349885371072512
Trimmed duplication, unnecessarily lengthy expressions and irrelevant information. Formatting for clarity.
Source Link
Anko
  • 13.4k
  • 10
  • 55
  • 82

How todo I render a rounded rectangle in libgdx?

I've been thinking of ways that I canto render a rounded rectangle in libgdx. Looking through the documentation I haven't found much that makes it easy to doa pre-built way in the documentation. Some options I've been lookinglooked at include:

The ShapeRenderer, but apparently that's quite expensive performance wise and I'll have to compose it of a polygon perhaps or use circles and rectangles.

Then I've been looking into using the Mesh class, which will probably be quite good performance wise but it feels quite complex to use for such a simple shape. And again, I'd have to create the polygon myself with an algorithm for different sizes of rounded rectangles.

  • ShapeRenderer, but that's apparently quite expensive performance-wise and I'll have to compose it of a polygon perhaps or use circles and rectangles.
  • The Mesh class, which would probably perform well but is complex to use for such a simple shape. Again, I'd have to create the polygon myself with an algorithm for different sizes of rounded rectangles.

I understand that the 2D shape library is quite limited in libgdx and it's not really their focus, but hopefullyCan someone can point me in the right direction here as I'd love to use libgdx for the project I'm working on.?

How to render a rounded rectangle in libgdx?

I've been thinking of ways that I can render a rounded rectangle in libgdx. Looking through the documentation I haven't found much that makes it easy to do. Some options I've been looking at include:

The ShapeRenderer, but apparently that's quite expensive performance wise and I'll have to compose it of a polygon perhaps or use circles and rectangles.

Then I've been looking into using the Mesh class, which will probably be quite good performance wise but it feels quite complex to use for such a simple shape. And again, I'd have to create the polygon myself with an algorithm for different sizes of rounded rectangles.

I understand that the 2D shape library is quite limited in libgdx and it's not really their focus, but hopefully someone can point me in the right direction here as I'd love to use libgdx for the project I'm working on.

How do I render a rounded rectangle in libgdx?

I've been thinking of ways to render a rounded rectangle in libgdx. I haven't found a pre-built way in the documentation. I've looked at:

  • ShapeRenderer, but that's apparently quite expensive performance-wise and I'll have to compose it of a polygon perhaps or use circles and rectangles.
  • The Mesh class, which would probably perform well but is complex to use for such a simple shape. Again, I'd have to create the polygon myself with an algorithm for different sizes of rounded rectangles.

Can someone point me in the right direction?

Source Link
lostpebble
  • 143
  • 1
  • 4

How to render a rounded rectangle in libgdx?

I've been thinking of ways that I can render a rounded rectangle in libgdx. Looking through the documentation I haven't found much that makes it easy to do. Some options I've been looking at include:

The ShapeRenderer, but apparently that's quite expensive performance wise and I'll have to compose it of a polygon perhaps or use circles and rectangles.

Then I've been looking into using the Mesh class, which will probably be quite good performance wise but it feels quite complex to use for such a simple shape. And again, I'd have to create the polygon myself with an algorithm for different sizes of rounded rectangles.

I understand that the 2D shape library is quite limited in libgdx and it's not really their focus, but hopefully someone can point me in the right direction here as I'd love to use libgdx for the project I'm working on.