Answers for "libgdx how to create an rectangle object"

1

how to draw a rectangle in libgdx

private ShapeRenderer shapeRenderer;

// in create method:
shapeRenderer = new ShapeRenderer();
shapeRenderer.setAutoShapeType(true);

// in render method:
shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
shapeRenderer.setColor(Color.GREEN);
shapeRenderer.rect(x, y, width, height);
shapeRenderer.end();
Posted by: Guest on April-24-2021

Code answers related to "libgdx how to create an rectangle object"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language