Text background

I think someone complained about inconsistency and so it was removed. If you were really curious then you could probably go through the SVN logs for that file (also available online) and see.

Ok. So I am having another problem with getting the quad behind my bitmaptext. Here is a picture of what im getting



http://i.imgur.com/kjuZa.jpg



And heres the code where i make them



[java]BitmapText sign = new BitmapText(guiFont);

sign.setSize(20);

sign.setColor(ColorRGBA.Black);

sign.setText(“70”);

sign.setLocalTranslation(cam.getScreenCoordinates(rootNode.getChild(gen.get(x).getName()).getLocalTranslation()));

sign.setLocalTranslation(sign.getLocalTranslation().x, sign.getLocalTranslation().y - 50, 0);

Quad background = new Quad(sign.getLineWidth(), sign.getLineHeight());

Geometry bg = new Geometry(“sign”, background);

bg.setLocalTranslation(sign.getLocalTranslation().x, sign.getLocalTranslation().y, -2);

Material back = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

back.setColor(“Color”, ColorRGBA.Black);

bg.setMaterial(back);

guiNode.attachChild(sign);

guiNode.attachChild(bg);[/java]



Can anyone help?

I think the quad is drawn with 0,0 in the lower left and text is by default drawn with 0,0 in the upper left.



So you probably just need to subtract the text’s height from the location of the background.

Thank you very much. Worked perfectly.

One final question. Where can I find other fonts I can use for the nifty gui because I am using the default one but I need it to be bigger?

You can make them in the SDK. You can also scale up the bitmap text… though beyond a little bit and it starts to look fuzzy.

I cant find where to make fonts searching on the wiki or in the help menu for the sdk.



Also by scale up the bitmap text do you mean in the .xml file make the height and width percentages higher or something else?

re: scaling… I thought you mean the BitmapText. I don’t remember how to do it in Nifty.



re: the font creator, I went and entered “making font” in the little google search box up there and the first hit was:

http://hub.jmonkeyengine.org/groups/jmonkeyplatform/forum/topic/font-creator-for-jmp/

i did the same and it didnt give me anything…o well

Which search box did you use? The one at the very top is nearly useless. The one that says “Custom Google Search” is the best one… that’s the one I used.