Example usage for com.badlogic.gdx.graphics.glutils ShapeRenderer setTransformMatrix

List of usage examples for com.badlogic.gdx.graphics.glutils ShapeRenderer setTransformMatrix

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.glutils ShapeRenderer setTransformMatrix.

Prototype

public void setTransformMatrix(Matrix4 matrix) 

Source Link

Usage

From source file:com.vlaaad.dice.ui.components.Rain.java

License:Open Source License

@Override
public void draw(Batch batch, float parentAlpha) {
    validate();//from   w  ww .j ava2s . c o  m
    batch.end();
    Gdx.gl.glClearColor(0, 0, 0, 0);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    ShapeRenderer renderer = Config.shapeRenderer;
    renderer.setProjectionMatrix(batch.getProjectionMatrix());
    renderer.setTransformMatrix(batch.getTransformMatrix());

    renderer.begin(ShapeRenderer.ShapeType.Filled);
    renderer.setColor(style.color.r, style.color.g, style.color.b, style.color.a * parentAlpha);
    float usedWidth = getWidth() - style.pad;
    int count = (int) (usedWidth / (style.dropWidth + style.pad));
    if (count == 0)
        return;
    float step = usedWidth / ((float) count);
    float x = style.pad;
    for (int i = 0, n = rows.size; i < n; i++) {
        Row row = rows.get(i);
        drawRow(x, row);
        x += step;
    }
    renderer.end();
    Gdx.gl.glDisable(GL20.GL_BLEND);
    batch.begin();
}

From source file:org.tntstudio.core.Screen.java

License:Apache License

@Override
public void vpApply(ShapeRenderer shape) {
    if (shape == null)
        return;/* w w w. j av a  2s  .com*/

    shape.setProjectionMatrix(projection);
    shape.setTransformMatrix(transform);
}

From source file:vault.clockwork.editor.props.PlankProp.java

License:Open Source License

/**
 * @param gizmo //from w  w w .  j  a v  a2 s.  co  m
 */
@Override
public void draw(ShapeRenderer gizmo) {
    Matrix4 transform = new Matrix4();
    transform.translate(position.x, position.y, 0);
    transform.rotate(0, 0, 1, angle);

    gizmo.setTransformMatrix(transform);
    gizmo.rect(-width, -height, width * 2, height * 2);
    gizmo.setTransformMatrix(new Matrix4());
    gizmo.setColor(Color.CYAN);
    gizmo.line(position, position.cpy().add(new Vector2(move_direction_x, move_direction_y).nor().scl(64.f)));
    gizmo.setColor(Color.YELLOW);
}

From source file:vault.clockwork.editor.props.StaticPlankProp.java

License:Open Source License

/**
 * @param gizmo //from www  .jav  a2  s.c  om
 */
@Override
public void draw(ShapeRenderer gizmo) {
    Matrix4 transform = new Matrix4();
    transform.translate(position.x, position.y, 0);
    transform.rotate(0, 0, 1, angle);

    gizmo.setTransformMatrix(transform);
    gizmo.rect(-width, -height, width * 2, height * 2);
    gizmo.setTransformMatrix(new Matrix4());

    gizmo.setColor(Color.ORANGE);
    gizmo.line(position, position.cpy().add(new Vector2(width, height).nor().scl(64.f)));
}