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

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

Introduction

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

Prototype

public Affine2 scale(float scaleX, float scaleY) 

Source Link

Document

Postmultiplies this matrix with a scale 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  w  w  w . j a  va 2 s  .  c om*/

    batch.setTransformMatrix(oldTransform);
}