forum

Home / DeveloperSection / Forums / Can't change font color in Libgdx using java

Can't change font color in Libgdx using java

Anonymous User563705-Oct-2013

I'm trying to change the color of the font I use in my application. But whatever I try the font remains black. I made this font using Hiero font tool.

My code is something like this:

    SpriteBatch batch = new SpriteBatch(); 
    BitmapFont font = new BtimapFont( Gdx.files.internal(MainAssets.pathToAssets + "font/comic.fnt"), Gdx.files.internal(MainAssets.pathToAssets + "font/comic.png"), false );


In render where I draw the font:

    batch.begin(); 
    font.setColor(1, 0, 0, 1);
    font.draw(batch, "Hello World!", 0, 0);
    batch.end();

Updated on 05-Oct-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By