2016-05-07 2 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)ありえない

私は、画像内の文字 "SHOP" を印刷したいです。しかし、イメージは暗い灰色の色ですので、私はfont.setColor(Color.WHITE)として白で文字 "SHOP"を印刷しようとしていますが、これは動作していません。

答えて

2

代わりに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

これは私の問題を解決しません。「SHOP」という単語はまだ黒で表示されています。 ( – user21478621

+0

@Yukiiはあなたのフォントテクスチャ黒ですか?フォントテクスチャは白でなければなりません。白をカラーにすることができますが、白をカラーにすることができます。 – desertkun

+0

フォントテクスチャは黒です元々白くしようとしています。 – user21478621

関連する問題