List of usage examples for com.badlogic.gdx.graphics.glutils ShapeRenderer arc
public void arc(float x, float y, float radius, float start, float degrees)
From source file:com.tussle.collision.CollisionCorner.java
License:Open Source License
public void draw(ShapeRenderer drawer) { double minAngle = FastMath.toDegrees(FastMath.atan2(minVec.yNorm(), minVec.xNorm())); double maxAngle = FastMath.toDegrees(FastMath.atan2(maxVec.yNorm(), maxVec.xNorm())); drawer.arc((float) x, (float) y, 12, (float) minAngle, (float) (maxAngle - minAngle)); drawer.line((float) x, (float) y, (float) (x + minVec.xNorm() * 20), (float) (y + minVec.yNorm() * 20)); drawer.line((float) x, (float) y, (float) (x + maxVec.xNorm() * 20), (float) (y + maxVec.yNorm() * 20)); }
From source file:logic.creatures.Eye.java
@Override protected void draw(ShapeRenderer s, double relX, double relY) { // Draw eye//from w w w . ja v a 2 s . co m s.setColor(1, 1, 1, 1); s.circle((float) (creature.getX() + relX), (float) (creature.getY() + relY), 3); // Draw FOV cone double degrees = fov * 360f / (double) Math.PI; double orient = (creature.getDirection() + angle) * 180f / (double) Math.PI - degrees / 2; if (Game.get().getWorld().getOptions().getOrDefault("draw_view_cones", 0d) > 0) { s.setColor(0.3f, 0.3f, 0.3f, 1); s.arc((float) (relX + creature.getX()), (float) (relY + creature.getY()), (float) sightRange, (float) orient, (float) degrees); } // Sight Lines double c = 0; if (Game.get().getWorld().getOptions().getOrDefault("draw_sight_lines", 0d) > 0) { for (Sight sight : sights) { if (sight != null) { c = sight.getDistance() / sightRange * 2 + sightRange; if (sight.getElement() instanceof Creature) { s.setColor((float) c, 0, 0, 1); } else if (sight.getElement() instanceof Vegetable) { s.setColor(0, (float) c, 0, 1); } s.line((float) (relX + creature.getX()), (float) (creature.getY() + relY), (float) (sight.getElement().getX()), (float) (sight.getElement().getY())); } } } }
From source file:net.noviden.towerdefense.UnitFactory.Unit.java
License:Open Source License
public void draw(ShapeRenderer shapeRenderer) { // draw each unit's health as a percent of its circle float percentHealthMissing = (1.0f - this.health / this.maxHealth); float degrees = percentHealthMissing * 360.0f; shapeRenderer.setColor(BASE_UNIT_COLOR); shapeRenderer.circle(location.x, location.y, BASE_RADIUS); if (percentHealthMissing > 0.0f) { shapeRenderer.setColor(BASE_UNIT_DAMAGED_COLOR); shapeRenderer.arc(location.x, location.y, BASE_RADIUS, rotation, degrees); }//from w ww . j a v a 2s .c o m }