Search in sources :

Example 1 with ScaleMode

use of org.terasology.rendering.nui.ScaleMode in project Terasology by MovingBlocks.

the class UIImage method onDraw.

@Override
public void onDraw(Canvas canvas) {
    if (image.get() != null) {
        if (ignoreAspectRatio) {
            ScaleMode scaleMode = canvas.getCurrentStyle().getTextureScaleMode();
            canvas.getCurrentStyle().setTextureScaleMode(ScaleMode.STRETCH);
            canvas.drawTexture(image.get(), tint.get());
            canvas.getCurrentStyle().setTextureScaleMode(scaleMode);
        } else {
            canvas.drawTexture(image.get(), tint.get());
        }
    }
}
Also used : ScaleMode(org.terasology.rendering.nui.ScaleMode)

Aggregations

ScaleMode (org.terasology.rendering.nui.ScaleMode)1