📜  如何在 libgdx 中绘制一个矩形 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:45.450000             🧑  作者: Mango

代码示例1
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();