Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the alpha of a bitmap font in libgdx

I want to make a message box that fade when you accept but I don't know how to change the alpha of a font,

here is how I do my font:

white = new BitmapFont(Gdx.files.internal("data/font/whitefont.fnt"),false);
white.setUseIntegerPositions(false);
white.setScale(0.025f);
white.draw(batchHUD, message.nom+":", 1000*0.1f+(1000*0.8f*0.3f), 625*0.1f+(1000*0.8f*0.625f*0.5f*0.1f)+1000*0.2f);

Can anyone help me ? :) I'm sorry for my english, it's not my native language.

like image 243
FuxTheFox Avatar asked Nov 20 '13 15:11

FuxTheFox


1 Answers

white.setColor(1, 1, 1, <alpha>);

This will change the alpha of the font for all following draws. So you would probably want to set it to full opaque again once you draw that message.

white.setColor(1, 1, 1, 1);
like image 160
Lestat Avatar answered Oct 04 '22 03:10

Lestat