I have two ImageTextbuttons and this is how I set them up in my MainMenu screen and in the Game screen:
我有两个ImageText按钮,这是我在MainMenu屏幕和Game屏幕中设置它们的方式:
ImageTextButton.ImageTextButtonStyle ibs = new ImageTextButton.ImageTextButtonStyle();
ibs.font = skin.getFont("scorescombo3-font160");
ibs.fontColor = new Color(1.0f, 0.6f, 0.0f, 0.65f);
ibs.up = new TextureRegionDrawable(skin.getRegion("level_name"));
level_no_button = new ImageTextButton("button", ibs);
I use the same font files exported from Hiero.
我使用从Hiero导出的相同字体文件。
In my Game screen I see the text as Orange as it's supposed to be seen but in my MainMenu screen it remains White even though the Alpha is rendered correctly.
在我的游戏屏幕中,我看到文本为橙色,因为它应该被看到但是在我的MainMenu屏幕中它仍然是白色,即使Alpha正确呈现。
I've searched for all level_no_button color setups inside my code and there is no line where I set the color to white. Why does color setting work on one screen but not on the other? More so , why does alpha work but color doesn't?
我在我的代码中搜索了所有level_no_button颜色设置,并且没有我将颜色设置为白色的行。为什么颜色设置在一个屏幕上工作而在另一个屏幕上不工作?更重要的是,为什么alpha工作,但颜色不?
1 个解决方案
#1
Apparently it was the shader in the other screen drawing the font in white.
显然,它是另一个屏幕中的着色器,用白色绘制字体。
I changed :
我变了 :
vec4 texColor = texture2D(u_texture, v_texCoord);
to : varying vec4 v_color; ...
to:改变vec4 v_color; ...
vec4 texColor = texture2D(u_texture, v_texCoord) * v_color;
and that fixed my issue.
这解决了我的问题。
#1
Apparently it was the shader in the other screen drawing the font in white.
显然,它是另一个屏幕中的着色器,用白色绘制字体。
I changed :
我变了 :
vec4 texColor = texture2D(u_texture, v_texCoord);
to : varying vec4 v_color; ...
to:改变vec4 v_color; ...
vec4 texColor = texture2D(u_texture, v_texCoord) * v_color;
and that fixed my issue.
这解决了我的问题。