List of usage examples for com.badlogic.gdx.graphics.glutils ShapeRenderer rect
public void rect(float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float degrees)
From source file:org.ams.testapps.paintandphysics.cardhouse.TurnCircle.java
License:Open Source License
/** Draw the turn circle. */ public void draw(ShapeRenderer worldRenderer) { if (!visible) return;// w w w. j av a 2s. c o m zoom = camera.zoom * (float) Math.sqrt(camera.viewportHeight / 10); worldRenderer.set(ShapeRenderer.ShapeType.Filled); worldRenderer.setColor(color); // draw circle for (Util.Triangle t : triangulatedCircle) { tmp_triangle[0] = t.a.x * zoom + position.x; tmp_triangle[1] = t.a.y * zoom + position.y; tmp_triangle[2] = t.b.x * zoom + position.x; tmp_triangle[3] = t.b.y * zoom + position.y; tmp_triangle[4] = t.c.x * zoom + position.x; tmp_triangle[5] = t.c.y * zoom + position.y; renderPolygonFilling(worldRenderer, tmp_triangle, fillingTriangle); } if (drawAngleSquare) { // draw square in middle float half = 0.1f * zoom; worldRenderer.rect(position.x - half, position.y - half, half, half, half * 2, half * 2, 1, 1, angleSquareAngle * MathUtils.radiansToDegrees); } if (drawMarkers) { // draw angle markers worldRenderer.set(ShapeRenderer.ShapeType.Line); worldRenderer.setColor(moreOpaqueColor); int n = (int) (360 / markerSpacing); float inner = radius * zoom; float outer = (radius + width * 0.1f) * zoom; float rotate = MathUtils.PI2 / n; for (int i = 0; i < n; i++) { v.set(inner, 0).rotateRad(rotate * i).add(position); v1.set(outer, 0).rotateRad(rotate * i).add(position); worldRenderer.line(v.x, v.y, v1.x, v1.y); } } }