I’m trying create text space in nifty:
[java] <panel id=“mapNamePanel” height=“50” width =“200” childLayout=“center”>
<text font=“SegoeUISemibold.fnt” text=“Map: ${PROP.MAP}”></text>
</panel>[/java]
Here’s my file:
I get error:[java]java.lang.RuntimeException: com.jme3.asset.AssetNotFoundException: SegoeUISemibold.fnt[/java],
Also, how can I set String value in my java class, and later get it from nifty? because I don’t know should I use normal String or somehow nifty property?
About variables , I guess you are referencing to this attribute in your xml : text=”Map: ${PROP.MAP}" right ? . If yes you just need to set a global variable in your nifty instance , calling this method
[java]
Properties properties = new Properties();
properties.setProperty(“MAP”, “whateveryouwant”);
manager.setGlobalProperties(properties);
[/java]
I believe that you must call this before you read from your xml but I’m not sure . Notice that Properties is a java.util class and you can also store them in a file . Here an example . Also you have an other choice to set a String in your xml : use a method the returns your property in your screen controller and then in xml :
[xml]
<panel id=”mapNamePanel” height=”50″ width =”200″ childLayout=”center”>
<text font=”SegoeUISemibold.fnt” text=”Map: ${CALL.yourmethod()}”></text>
</panel>
[/xml]
Here you have a bit more flexibility .
Just tried with the last sdk and it works… here is my code and xml:
[java]
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
guiViewPort);