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

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

Introduction

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

Prototype

public TextBounds drawMultiLine(Batch batch, CharSequence str, float x, float y, float alignmentWidth,
        HAlignment alignment) 

Source Link

Document

Draws a string, which may contain newlines (\n), at the specified position.

Usage

From source file:com.minekrash.game.Paint.java

public void drawText(SpriteBatch g, BitmapFont _font, String _texto, Color _color, float _x, float _y,
        BitmapFont.HAlignment _alineacion, float _alphaText) {
    _font.setColor(Color.BLACK.r, Color.BLACK.g, Color.BLACK.b, _alphaText);
    _font.drawMultiLine(g, _texto, _x, _y - 0.2f, 0, _alineacion);
    _font.setColor(_color.r, _color.g, _color.b, _alphaText);
    _font.drawMultiLine(g, _texto, _x, _y, 0, _alineacion);
}

From source file:com.packtpub.libgdx.canyonbunny.game.WorldRenderer.java

License:Apache License

private void renderGuiGameOverMessage(SpriteBatch batch) {
    float x = cameraGUI.viewportWidth / 2;
    float y = cameraGUI.viewportHeight / 2;
    if (worldController.isGameOver()) {
        BitmapFont fontGameOver = Assets.instance.fonts.defaultBig;
        fontGameOver.setColor(1, 0.75f, 0.25f, 1);
        fontGameOver.drawMultiLine(batch, "GAME OVER", x, y, 1, BitmapFont.HAlignment.CENTER);
        fontGameOver.setColor(1, 1, 1, 1);
    }/*from   w ww.j a v a  2  s .  c o  m*/
}

From source file:org.bladecoder.bladeengine.util.TextUtils.java

License:Apache License

public static void drawCentered(SpriteBatch batch, BitmapFont font, CharSequence str, float x, float y) {
    float x2, y2;

    TextBounds b = font.getMultiLineBounds(str);

    x2 = x - b.width / 2;//w w w. j ava  2s . c om
    y2 = y - b.height / 2;

    font.drawMultiLine(batch, str, x2, y2, b.width, HAlignment.CENTER);
}

From source file:org.bladecoder.bladeengine.util.TextUtils.java

License:Apache License

public static void drawCenteredScreenY(SpriteBatch batch, BitmapFont font, CharSequence str, float x,
        int viewportHeight) {
    float y;/*w  w  w  .jav a  2s . com*/

    TextBounds b = font.getMultiLineBounds(str);

    y = (viewportHeight - b.height) / 2;

    font.drawMultiLine(batch, str, x, y, b.width, HAlignment.CENTER);
}

From source file:org.bladecoder.bladeengine.util.TextUtils.java

License:Apache License

public static void drawCenteredScreenX(SpriteBatch batch, BitmapFont font, CharSequence str, float y,
        int viewportWidth) {

    float x;/*  ww  w. j ava 2s  . c o m*/

    TextBounds b = font.getMultiLineBounds(str);

    x = (viewportWidth - b.width) / 2;

    font.drawMultiLine(batch, str, x, y, b.width, HAlignment.CENTER);
}