Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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();
 
PREVIOUS NEXT
Tagged: #draw #rectangle #libgdx
ADD COMMENT
Topic
Name
7+4 =