Reputation: 7114
I have some 3-4 years old game project in libGDX. Now I decided to update it and to move from Eclipse to Android studio. So, I installed A.S. downloaded and installed fresh libGDX project. Then added my old source files and assets. All went well, with some minor changes game runs. Except font.setColor is not working any more - text on screen is black. Transparency is not working neither. That worked well before.
So, my font is generated with Hiero, and it's white (I saw that in some other questions here that it must be white).
font = new BitmapFont(Gdx.files.internal("fonts/bundy.fnt"),
Gdx.files.internal("fonts/bundy_0.png"), false);
...
font.setColor(0.2f, 0.5f, 0.2f, 1.0f);
font.draw(game.batch, "MAP" , 835,580);
To mention that I used
import com.badlogic.gdx.graphics.GL10;
but now I moved to
import com.badlogic.gdx.graphics.GL20;
since GL10 is not supported any more.
Also, now I'm using GlyphLayout
class to get text boundaries. I don't see any other change that could have any influence to font color.
Any idea why setColor is not working? Is there some new step added meanwhile that I have to do?
Upvotes: 1
Views: 1410
Reputation: 7114
Ok found it!
So, old font image file, that was working well on old libGDX, but won't work in new was in 8 bit png grayscale. Letters were white and background was black.
Now I generated new font with latest Hiero and it was in 8bit png, but in color mode, with white letters and TRANSPARENT background and that works well.
So it was about image format.
P.S. Transparency is still not working...but I can live with that.
Upvotes: 1