Example usage for com.badlogic.gdx.math Affine2 translate

List of usage examples for com.badlogic.gdx.math Affine2 translate

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Affine2 translate.

Prototype

public Affine2 translate(float x, float y) 

Source Link

Document

Postmultiplies this matrix by a translation matrix.

Usage

From source file:com.trgk.touchwave.tgengine.ui.TGText.java

License:Open Source License

@Override
public void draw(Batch batch, float parentAlpha) {
    Matrix4 oldTransform = new Matrix4(batch.getTransformMatrix());
    Affine2 localTransform = new Affine2();
    localTransform.setToTrnScl(getX() + getOriginX(), getY() + getOriginY(), getScaleX(), getScaleY());
    localTransform.translate(-getOriginX(), -getOriginY());
    localTransform.scale(1f / TGResources.baseFontSize, 1f / TGResources.baseFontSize);

    Matrix4 localTransformMatrix = new Matrix4();
    localTransformMatrix.set(localTransform);

    Matrix4 newTransform = new Matrix4(oldTransform);
    newTransform.mul(localTransformMatrix);
    batch.setTransformMatrix(newTransform);

    Color alphaMultipliedColor = new Color(getColor());
    alphaMultipliedColor.a *= parentAlpha;
    drawCache.tint(alphaMultipliedColor);
    drawCache.draw(batch);//from   www .  j  a  va 2 s .  c om

    batch.setTransformMatrix(oldTransform);
}