BitmapText color

hi,

I’m havng trouble getting the Color of BitmapText.

BitmapText getColor() doesn’t seem to work properly:

[java]

public void simpleInitApp() {

java.util.logging.Logger.getLogger("").setLevel(Level.SEVERE);

BitmapText textNode = new BitmapText(assetManager.loadFont(“Interface/Fonts/Default.fnt”), false);

ColorRGBA color = ColorRGBA.Red.clone();

textNode.setColor(color);

System.out.println("Original color: " + color);

System.out.println("Returned color: " + textNode.getColor());

}

[/java]

What version of JME are you running? There have been some fixes made to BitmapText since Alpha 4… specifically related to color. So if you aren’t already you should be using the nightly builds.



What is the output you get from the above test?

Output:

Original color: Color[1.0, 0.0, 0.0, 1.0]
Returned color: Color[1.0, 1.0, 1.0, 1.0]


Version: jME3_2011-06-30

Code from BitmapText.java
[java] /**
* @return color of the text
*/
public ColorRGBA getColor() {
return block.getColor();
}

/**
* changes text color. all substring colors are deleted.
* @param color new color of text
*/
public void setColor(ColorRGBA color) {
letters.setColor(color);
letters.invalidate(); // TODO: Don't have to align.
needRefresh = true;
}[/java]

Ok, I just fixed this in subversion.



I have it return the base color of the letters which should be right in most cases.