Home > DeveloperSection > Forums > Can't change font color in Libgdx using java
F Scott Fitzgerald
F Scott Fitzgerald

Total Post:29

Points:203
Posted on    October-05-2013 7:40 AM

 Java Java 
Ratings:


 1 Reply(s)
 3316  View(s)
Rate this:

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();


Ida B Wells
Ida B Wells

Total Post:30

Points:210
Posted on    October-05-2013 8:59 AM

you can use this

font.setColor(Color.BLUE);

Don't want to miss updates? Please click the below button!

Follow MindStick