I’ve just started learning Libgdx from today by looking at some of the tutorials and find this framework really good, however, I’ve bumped in a minor problem. I’ve set up the fonts with the BitmapFont and was trying to use a method to scale the size of the text, however, I cannot find the scale() method. Did I forget to import something ? or pehaps miss something ?
import com.badlogic.gdx.graphics.g2d.BitmapFont; for the
private BitmapFont font; I was able to change the color fo the font by using
font.setColor(Color.GREEN); But I’m unable to call some methods to scale the text . Should I import the entire thing ? or should I have added additional libs in the first place ? I’ve listed all the imports that I have in my activity.
import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas;
Don’t use scale. Scaling fonts looks terrible and should be avoided. Instead, use LibGDX’s FreeTypeFontGenerator to generate the BitmapFont at the correct size for your application without any scaling.