2016-05-07 4 views
1
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); 

}Libgdx font.setColor (Color.White) ist nicht arbeiten

Ich mag die Buchstaben "SHOP" im Bild drucken. Das Bild ist jedoch in einer dunkelgrauen Farbe, daher versuche ich den Buchstaben "SHOP" in weiß als font.setColor (Color.WHITE) zu drucken, aber das funktioniert nicht.

Antwort

2

Verwenden Sie stattdessen 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); 

} 
+0

das behebt mein Problem nicht .. das Wort "SHOP" wird immer noch in schwarz angezeigt. Ich erzeuge meine Schriftart durch AngelCode, wenn dies hilft :( – user21478621

+0

@Yukii ist Ihre Schriftart Textur schwarz? Die Schriftart Textur sollte weiß sein, weil Sie weiß, um Farbe zu sein, aber können Farbe weiß sein. – desertkun

+0

Die Schrift Textur ist schwarz ursprünglich und ich versuche, sie weiß zu machen .. – user21478621