Reputation: 3548
I am using custom font in andengine and when the user click that ui I need to change the color of my ui.Here is my code.
Text exit=new Text(250, 390, this.mPlokFont, "Exit");
exit.setColor(255,0, 0, 255);
scene.attachChild(exit);
but it doesn't work. My font :
mPlokFont = FontFactory.createFromAsset(this.mPlokFontTexture, this, "Plok.ttf", 16, true, Color.WHITE);
Thanks in advance.
Upvotes: 1
Views: 4352
Reputation: 410
I'm pretty sure you are facing this issue because you are using premultiplied alpha in the font texture. Try this
mFontTexture = new BitmapTextureAtlas(256, 256, TextureOptions.BILINEAR);
mUIFont = new Font(m_FontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32, true, Color.WHITE);
and it should work. AFAIK, premultiplied alpha means the RGB values in the texture are already multiplied by an alpha value, so calling .setAlpha() will not change anything (it will not be applied.
Upvotes: 4