Hi guys,
just started to work with JME3.
at the moment I try to create the GUI in a own class (for making the Main() easier to read).
At this time it`s just a “healthbar”.
I used the HUDText from the patterns to do this.
Now the Problem:
when i do this from the Main() everything works fine. I then toke it to an HUDcontroller called class, istantiated a HUDController and used it`s Method for updating the HUD.
On starting the game it brakes directly and a null-pointer-exception is thrown:
Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at mygame.HUDcontroller.healthMeter(HUDcontroller.java:22)
at mygame.HUDcontroller.showHUD(HUDcontroller.java:35)
at mygame.Main.updateHUD(Main.java:198)
at mygame.Main.simpleUpdate(Main.java:67)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:242)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:744)
HUDController line 22 is:
guiFont = assetManager.loadFont(“Interface/Fonts/Default.fnt”);
cause its the first line of the exception i think this is the mainpoint of the problem, but i don`t understand why it works from the Main() (its exactly the same line)
is there any way i have to adept this path for the fonts when i dont use it from main?
Thanks for help and greetings from Germany,
Birchwood