CAN'T CHANGE FONT COLOR IN LIBGDX USING JAVA

Total Post:28

Points:196
Java 
 4767  View(s)
Ratings:
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();
  1. Post:30

    Points:210
    Re: Can't change font color in Libgdx using java

    you can use this

    font.setColor(Color.BLUE);

      Modified On Mar-31-2018 06:23:02 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!