简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM