List of usage examples for com.badlogic.gdx.graphics.g2d BitmapFont getWrappedBounds
public TextBounds getWrappedBounds(CharSequence str, float wrapWidth)
From source file:org.bladecoder.bladeengine.util.TextUtils.java
License:Apache License
public static float getCenterX(BitmapFont font, CharSequence str, float maxLength, int viewportWidth) { float x;/*from w ww . j av a2s .c o m*/ TextBounds b = font.getWrappedBounds(str, maxLength); x = (viewportWidth - b.width) / 2; return x; }
From source file:org.bladecoder.bladeengine.util.TextUtils.java
License:Apache License
public static float getCenterY(BitmapFont font, CharSequence str, float maxLength, int viewportHeight) { float y;//from w ww .j a v a2 s . c o m TextBounds b = font.getWrappedBounds(str, maxLength); y = (viewportHeight + b.height) / 2; return y; }