Accessing protected fields of SimpleApplication from AbstractAppState subclasses

Hello friends, I’m beginner at JMonkey and need your help.
I have 2 Subclass of AbstractAppState, InGameState and MainScreenState.
In InGameState I need to draw a Cross Hairs on screen but, I can’t access to the guiNode of simpleApplication because it is protected!
I’m wondering how to access protected fields of simpleApplication in state classes.
Is it right to create a getter method in simpleApplicaction subclass to get these such fields ?!
thanks in advance!

In the InGameState class, override the initialize method from the AbstractAppState class and then use app.getGuiNode().

Yes that would be fine, but it already exists:
http://hub.jmonkeyengine.org/javadoc/com/jme3/app/SimpleApplication.html#getGuiNode()

@wezrule @fowlie
Thanks for your response
what can i do with guiFont?
create a getter/setter for this ?!

I got it!
Actually SimpleApplication takes its guiFont from assetManager!
So i use assetManager directly from state class to get the font!
Thanks again!

@Normen
@wezrule i want to access settings field of Application in state class but it is protected :frowning:
how can i do ?

[java]app.getContext().getSettings()[/java]

@wezrule said: [java]app.getContext().getSettings()[/java]
Thank you dear, thanks : )

How about you do some tutorials?

All this is covered. You would gain a lot. Just saying.

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3

@madjack said: How about you do some tutorials?

All this is covered. You would gain a lot. Just saying.

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3

If it doesn’t fit into a meme its TL;DR :wink: