I just committed some changes to the repository that update the ShapeRenderer API. Yes, it’ll break you current code but the fixes will be trivial.
We’ve changed from having a large number of ShapeTypes (Rectangle, FilledRectangle, etc.) to having 3 shape types reflecting the underlying OpenGl primitives used: ShapeType.Point, ShapeType.Line and ShapeType.Filled.
This allows us to batch various shapes that previously would’ve caused a new batch. For example:
renderer.rect(0, 0, 1, 1);
renderer.circle(0.2f, 0.2f, 0.5f, 40);
renderer.cone(0.6f, 0.6f, 0, 0.3f, 0.75f, 20);
renderer.triangle(-0.1f, 0.1f, -0.6f, -0.1f, -0.3f, 0.5f);
Previously that would’ve required 4 batches and can now be done in one 🙂
There are a few exceptions to note: Line, Curve, Polygon & Box only work with ShapeType.Line. Point plotting only works with ShapeType.Point. The rest works for both ShapeType.Line & ShapeType.Filled. If you make a mistake here, it’ll throw an exception.
Sorry for breaking the API but I figured it was worth it for making it easier & faster to use ShapeRenderer.