How to change the alpha of a bitmap font in libgdx(如何在 libgdx 中更改位图字体的 alpha)
问题描述
我想制作一个消息框,当您接受时会消失,但我不知道如何更改字体的 alpha,
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,
我的字体是这样的:
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>);
这将更改所有后续绘制的字体的 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);
这篇关于如何在 libgdx 中更改位图字体的 alpha的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 libgdx 中更改位图字体的 alpha
基础教程推荐
- 如何对 Java Hashmap 中的值求和 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 存储 20 位数字的数据类型 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
