Example usage for com.badlogic.gdx.graphics.g2d BitmapFont getAscent

List of usage examples for com.badlogic.gdx.graphics.g2d BitmapFont getAscent

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d BitmapFont getAscent.

Prototype

public float getAscent() 

Source Link

Document

Returns the ascent, which is the distance from the cap height to the top of the tallest glyph.

Usage

From source file:org.illarion.engine.backend.gdx.GdxGraphics.java

License:Open Source License

@Override
public void drawText(@Nonnull final Font font, @Nonnull final CharSequence text, @Nonnull final Color color,
        final int x, final int y, final double scaleX, final double scaleY) {
    if (font instanceof GdxFont) {
        activateSpriteBatch();/*from   w  ww. j  a va  2s . c om*/
        transferColor(color, tempColor1);
        final BitmapFont bitmapFont = ((GdxFont) font).getBitmapFont();
        bitmapFont.setScale((float) scaleX, (float) scaleY);
        bitmapFont.setColor(tempColor1);
        bitmapFont.draw(spriteBatch, text, x, y - bitmapFont.getAscent());
    }
}