gpt4 book ai didi

java - LibGdx font.setColor(Color.WHITE) 不起作用

转载 作者:行者123 更新时间:2023-11-30 02:56:33 27 4
gpt4 key购买 nike

public void show()
{
buttonsAtlas = new TextureAtlas("spellButton.pack"); //button atlas image
buttonSkin = new Skin();
buttonSkin.addRegions(buttonsAtlas);
font = new BitmapFont(Gdx.files.internal("WhiteAlpha.fnt"), false); //the font
font.setColor(Color.WHITE);

stage = new Stage(); // window is stage
stage.clear();

TextButton.TextButtonStyle ribbonStyle = new TextButton.TextButtonStyle(); //Shop title ribbon properties
ribbonStyle.up = buttonSkin.getDrawable("ribbon");
ribbonStyle.down = buttonSkin.getDrawable("ribbon");
ribbonStyle.font = font;

ribbon = new TextButton("SHOP", ribbonStyle); //shop title outlook adn textstyle
ribbon.setPosition(200, 1720);
ribbon.setSize(880, 200);

}

我想在图像中打印字母“SHOP”。然而图像是深灰色的,所以我试图将字母“SHOP”打印为白色作为 font.setColor(Color.WHITE) 但这不起作用。

最佳答案

改用ribbonStyle.fontColor

public void show()
{
buttonsAtlas = new TextureAtlas("spellButton.pack"); //button atlas image
buttonSkin = new Skin();
buttonSkin.addRegions(buttonsAtlas);
font = new BitmapFont(Gdx.files.internal("WhiteAlpha.fnt"), false); //the font

stage = new Stage(); // window is stage
stage.clear();

TextButton.TextButtonStyle ribbonStyle = new TextButton.TextButtonStyle(); //Shop title ribbon properties
ribbonStyle.up = buttonSkin.getDrawable("ribbon");
ribbonStyle.down = buttonSkin.getDrawable("ribbon");
ribbonStyle.font = font;

// change it here (per style)
-> ribbonStyle.fontColor = Color.WHITE;

ribbon = new TextButton("SHOP", ribbonStyle); //shop title outlook adn textstyle
ribbon.setPosition(200, 1720);
ribbon.setSize(880, 200);

// or, you can change it here (per button)
-> ribbon.setColor(Color.WHITE);

}

关于java - LibGdx font.setColor(Color.WHITE) 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37094151/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com