Java Code Examples for com.badlogic.gdx.graphics.glutils.ShapeRenderer#set()

The following examples show how to use com.badlogic.gdx.graphics.glutils.ShapeRenderer#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Player.java    From ud405 with MIT License 6 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.setColor(Constants.PLAYER_COLOR);
    renderer.set(ShapeType.Filled);
    renderer.circle(position.x, position.y, Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_HEAD_SEGMENTS);

    Vector2 torsoTop = new Vector2(position.x, position.y - Constants.PLAYER_HEAD_RADIUS);
    Vector2 torsoBottom = new Vector2(torsoTop.x, torsoTop.y - 2 * Constants.PLAYER_HEAD_RADIUS);

    renderer.rectLine(torsoTop, torsoBottom, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x + Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x - Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x + Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x - Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
}
 
Example 2
Source File: Player.java    From ud405 with MIT License 6 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.setColor(Constants.PLAYER_COLOR);
    renderer.set(ShapeType.Filled);
    renderer.circle(position.x, position.y, Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_HEAD_SEGMENTS);

    Vector2 torsoTop = new Vector2(position.x, position.y - Constants.PLAYER_HEAD_RADIUS);
    Vector2 torsoBottom = new Vector2(torsoTop.x, torsoTop.y - 2 * Constants.PLAYER_HEAD_RADIUS);

    renderer.rectLine(torsoTop, torsoBottom, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x + Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x - Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x + Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x - Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
}
 
Example 3
Source File: Player.java    From ud405 with MIT License 6 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.setColor(Constants.PLAYER_COLOR);
    renderer.set(ShapeType.Filled);
    renderer.circle(position.x, position.y, Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_HEAD_SEGMENTS);

    Vector2 torsoTop = new Vector2(position.x, position.y - Constants.PLAYER_HEAD_RADIUS);
    Vector2 torsoBottom = new Vector2(torsoTop.x, torsoTop.y - 2 * Constants.PLAYER_HEAD_RADIUS);

    renderer.rectLine(torsoTop, torsoBottom, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x + Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x - Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x + Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x - Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
}
 
Example 4
Source File: Player.java    From ud405 with MIT License 6 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.setColor(Constants.PLAYER_COLOR);
    renderer.set(ShapeType.Filled);
    renderer.circle(position.x, position.y, Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_HEAD_SEGMENTS);

    Vector2 torsoTop = new Vector2(position.x, position.y - Constants.PLAYER_HEAD_RADIUS);
    Vector2 torsoBottom = new Vector2(torsoTop.x, torsoTop.y - 2 * Constants.PLAYER_HEAD_RADIUS);

    renderer.rectLine(torsoTop, torsoBottom, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x + Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x - Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x + Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x - Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
}
 
Example 5
Source File: Player.java    From ud405 with MIT License 6 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.setColor(Constants.PLAYER_COLOR);
    renderer.set(ShapeType.Filled);
    renderer.circle(position.x, position.y, Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_HEAD_SEGMENTS);

    Vector2 torsoTop = new Vector2(position.x, position.y - Constants.PLAYER_HEAD_RADIUS);
    Vector2 torsoBottom = new Vector2(torsoTop.x, torsoTop.y - 2 * Constants.PLAYER_HEAD_RADIUS);

    renderer.rectLine(torsoTop, torsoBottom, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x + Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x - Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x + Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x - Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
}
 
Example 6
Source File: Player.java    From ud405 with MIT License 6 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.setColor(Constants.PLAYER_COLOR);
    renderer.set(ShapeType.Filled);
    renderer.circle(position.x, position.y, Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_HEAD_SEGMENTS);

    Vector2 torsoTop = new Vector2(position.x, position.y - Constants.PLAYER_HEAD_RADIUS);
    Vector2 torsoBottom = new Vector2(torsoTop.x, torsoTop.y - 2 * Constants.PLAYER_HEAD_RADIUS);

    renderer.rectLine(torsoTop, torsoBottom, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x + Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
    renderer.rectLine(
            torsoTop.x, torsoTop.y,
            torsoTop.x - Constants.PLAYER_HEAD_RADIUS, torsoTop.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x + Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);

    renderer.rectLine(
            torsoBottom.x, torsoBottom.y,
            torsoBottom.x - Constants.PLAYER_HEAD_RADIUS, torsoBottom.y - Constants.PLAYER_HEAD_RADIUS, Constants.PLAYER_LIMB_WIDTH);
}
 
Example 7
Source File: Icicle.java    From ud405 with MIT License 5 votes vote down vote up
public void render(ShapeRenderer renderer) {

        // TODO: Set the ShapeRenderer's color
        renderer.setColor(Constants.ICICLE_COLOR);

        // TODO: Set the ShapeType
        renderer.set(ShapeType.Filled);

        // TODO: Draw the icicle using the size constants
        renderer.triangle(
                position.x, position.y,
                position.x - Constants.ICICLES_WIDTH / 2, position.y + Constants.ICICLES_HEIGHT,
                position.x + Constants.ICICLES_WIDTH / 2, position.y + Constants.ICICLES_HEIGHT
        );
    }
 
Example 8
Source File: Animation.java    From riiablo with Apache License 2.0 5 votes vote down vote up
public void drawDebug(ShapeRenderer shapes, float x, float y) {
  if (DEBUG_MODE == 0) {
    return;
  } else if (DEBUG_MODE == 1 || cof == null) {
    boolean reset = !shapes.isDrawing();
    if (reset) {
      shapes.begin(ShapeRenderer.ShapeType.Line);
    } else {
      shapes.set(ShapeRenderer.ShapeType.Line);
    }

    shapes.setColor(Color.RED);
    shapes.line(x, y, x + 50, y);
    shapes.setColor(Color.GREEN);
    shapes.line(x, y, x, y + 50);
    shapes.setColor(Color.BLUE);
    shapes.line(x, y, x + 15, y - 20);
    shapes.setColor(Color.GREEN);
    shapes.rect(x + box.xMin, y - box.yMax, box.width, box.height);
    if (reset) shapes.end();
  } else if (DEBUG_MODE == 2 && frame < numFrames) {
    int d = DC.Direction.toReadDir(direction, cof.getNumDirections());
    int f = frame;
    for (int l = 0; l < cof.getNumLayers(); l++) {
      int component = cof.getLayerOrder(d, f, l);
      Layer layer = layers[component];
      if (layer != null) layer.drawDebug(shapes, d, f, x, y);
    }
  }
}
 
Example 9
Source File: Entity.java    From riiablo with Apache License 2.0 5 votes vote down vote up
public void drawDebugTarget(ShapeRenderer shapes) {
  if (target.isZero() || !path.isEmpty()) return;
  EngineUtils.worldToScreenCoords(target, tmpVec2);
  shapes.set(ShapeRenderer.ShapeType.Filled);
  shapes.setColor(Color.ORANGE);
  shapes.rectLine(screen.x, screen.y, tmpVec2.x, tmpVec2.y, 1);
  shapes.set(ShapeRenderer.ShapeType.Line);
}
 
Example 10
Source File: TransformScalableWrapper.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
@Override
protected void drawDebugBounds(ShapeRenderer shapes) {
    if (!getDebug()) return;
    shapes.set(ShapeRenderer.ShapeType.Line);
    shapes.setColor(getStage().getDebugColor());
    shapes.rect(getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), 1f, 1f, getRotation());
}
 
Example 11
Source File: Boulder.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer){
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, radius);
}
 
Example 12
Source File: BouncingBall.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, radius);
}
 
Example 13
Source File: BouncingBall.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, radius);
}
 
Example 14
Source File: BouncingBall.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer) {
    // This takes advantage of AutoShapeType
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, radius);
}
 
Example 15
Source File: BouncingBall.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, baseRadius * radiusMultiplier);
}
 
Example 16
Source File: BouncingBall.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, baseRadius * radiusMultiplier);
}
 
Example 17
Source File: BouncingBall.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, baseRadius * radiusMultiplier);
}
 
Example 18
Source File: Boulder.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer){
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, radius);
}
 
Example 19
Source File: BouncingBall.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer shapeRenderer){
    shapeRenderer.set(ShapeType.Filled);
    shapeRenderer.setColor(Color.RED);
    shapeRenderer.circle(position.x, position.y, radius, 20);
}
 
Example 20
Source File: BouncingBall.java    From ud405 with MIT License 4 votes vote down vote up
public void render(ShapeRenderer renderer) {
    renderer.set(ShapeType.Filled);
    renderer.setColor(COLOR);
    renderer.circle(position.x, position.y, radius);
}