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

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

Introduction

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

Prototype

public Affine2 setToTrnScl(float x, float y, float scaleX, float scaleY) 

Source Link

Document

Sets this matrix to a concatenation of translation and scale.

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  w  w  w.  ja va 2 s  .  com

    batch.setTransformMatrix(oldTransform);
}