dvrer
dvrer

Reputation: 629

how to use bitmap font that have 2 png files libGDX?

i have a bitmap font that have: font.fnt font_0.png font_1.png

i dont know how to handle 2 png for files i know how to use this code but only for 1 png:

 Imgfont = new BitmapFont(Gdx.files.internal("font.fnt"),
                Gdx.files.internal("font_0.png"),Gdx.files.internal("font_1.png"), false);

        spriteBatch.begin();
        font.setColor(1.0f, 1.0f, 1.0f, 1.0f);
        font.draw(spriteBatch, "some string", 25, 160);
        spriteBatch.end();

any idea?

Upvotes: 2

Views: 731

Answers (1)

Mayank Bhatnagar
Mayank Bhatnagar

Reputation: 1346

If you have 2 png files of bitmap, then you have to do just

Imgfont = new BitmapFont(Gdx.files.internal("font.fnt"), false);

it takes all the png(s) automatically.

And if you have single png file then, it is your wish to pass the png file. If you don't it will take automatically.

Imgfont = new BitmapFont(Gdx.files.internal("font.fnt"), Gdx.files.internal("font_0.png") , false ) ;

Upvotes: 1

Related Questions