Cannot find BitmapFont.TextBounds in libgdx

Viewed 198

I tried to write this piece of code but it is showing error saying it cannot find TextBounds. But it works fine with when I use only BitmapFont.

package com.gamefromscratch;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;

public class TextDemo extends ApplicationAdapter
{
    SpriteBatch batch;
    BitmapFont font;
    BitmapFont.TextBounds bounds;
    String mytext;
}

I am using Netbeans 8.2

1 Answers

BitmapFont was modified several years ago and TextBounds was removed. GlyphLayout is now used instead. This link below explains the changes and provides example code showing how to modify the old version to the new version.

https://www.badlogicgames.com/wordpress/?p=3658

Related