SimpleApplication

Hi

Its the first time i use the JMonkeyEngine, but not the first time that I write a Game. I am so cofused with SimpleApplication.
There are so many things i dont Need like all the informations in bottom left Corner, the strange slow flycam.
I read a article with told me i can write my own Application. But there is no wiki page witch is telling me how.
How can i create a own Application without annything I want to do every gamebased Thing myself.

Thanks RaverGames

SimpleApplication comes with its handy package of tools : flycam, stat display, fps, keyboard shortcuts for printing memory and so on.
If you don’t want this, you can just disable them.
2 ways of doing it :
in the simpleInit method call :
[java]
stateManager.detach(stateManager.getState(FlyCamAppState.class));
stateManager.detach(stateManager.getState(ResetStatsState.class));
stateManager.detach(stateManager.getState(DebugKeysAppState.class));
stateManager.detach(stateManager.getState(StatsAppState.class));
[/java]
This will disable the debug states.
You can also create a constructor for your SimpleApplication child class and call the super with a null argument.
Those states won’t even be initialized.

[java]
class MyApplication extends SimpleApplication{
public MyApplication() {
super(null);
}

}
[/java]

I really don’t recommend Extending directly application, there are plenty of things you’ll have to do, and you’ll end up copying most of the SimpleApplication code.

2 Likes

Those things are all AppStates. You can create your own constructor for your class (that inherits from SimpleApplication) and just not call super() ;

http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/app/SimpleApplication.java

EDIT: Doh! nehon got here first :slight_smile:

1 Like

Use SimpleApplication. There are about 20-100 threads on how to disable that other stuff but there is a bunch of stuff in SimpleApplication that you actually DO want. And if you don’t want that stuff then going directly to jwjgl directly might be better. :wink:

Seriously, you can disable all of the default stuff like the debug screen, fly cam, etc. just by having a constructor and calling super(null). Then all you get after that is proper management of the scene graph state and AppStateManager (which is something you really want).

2 Likes

d’oh… double-ninja’ed.

EDIT: Doh! nehon got here first
i'm always lurking around ;)

Ok thanks for this fast and greate help.

I gonna try it out in the next morning.