我正在尝试在libgdx中使用shaperenderer绘制一个多边形,但它出现了以下错误:
方法polygon(float [])未定义ShapeRenderer类型
这是我的代码:
ShapeRenderer renderer = new ShapeRenderer();
renderer.setColor(0, 0, 0, 0);
if(isbox)
{
renderer.begin(ShapeType.Rectangle);
renderer.rect(defaultsettings.MeterToPixWidthScaling(position.x - (width/2)), defaultsettings.MeterToPixHeightScaling(position.y - (height/2)), defaultsettings.MeterToPixWidthScaling(width),defaultsettings.MeterToPixWidthScaling(height));
}else{
renderer.begin(ShapeType.Line);
renderer.polygon(new float[] { -10, 0, 10, 0, 0, 200 });
}
renderer.end();