Running jME without RenderWindow

Hey Guys,
I tried to find out on my own but it seems like I am doing it wrong.

I coded a “joystick mapping tool”, it basically dumps all inputManager.getJoysticks() and their respective Axis and Buttons.
It then listens using a rawInputListener() and uses .println() to dump pressed keys.

My Problem was, I was to lazy to mess around with JInput so I simply used jME for that.

I now limit the FPS to 10, but I did not find a way to remove the window completely.
If I use ``` viewPort and guiViewport.setEnabled(false); `, I get a “NullRenderer” exception and this might be the wrong approach anyway.

So how would be the proper way? Which Application should I extend? (As HeadlessServerApplication does NOT have any Input.

PS: Some SDK usage question, is there an easy way to remove nifty from the libs? As all the jars’ seem to be bundled to jme-libs. Do I have to create an own “jme-libs-without-nifty” and manually add all jars?

“ignores all input – no input handling.”

Does that mean that the default flycam is disabled then?
I thought there is no inputManager and it’s Listeners at all, which is my problem.
Edit: Yep, inputManager is null when running as Server, hence my question here =)

If you’re looking for joysticks only, you should be able to initialize InputManager with a DummyKeyInput, DummyMouseInput and JInputJoyInput.
Creating JInputJoyInput does not actually require a jME3 context, so this should work just fine.

I gave it a try and the recognition of the Joysticks work fine, but I don’t receive any events.
I looked into the Sourcecode to find out that e.g. the lwjgl Render uses
com.jme3.system.NativeLibraryLoader.loadNativeLibrary("jinput", true);, which is not known by my SDK (I guess that’s because there was some refactoring of com.jme3.system.Natives )?

Now I wonder if it’s even the problem of JInput Missing (as I wouldn’t expect any fuctionality of inputManager at all) or if I am missing something different?

Try JmeSystem.initialize(). Make sure the AppSettings object you pass to it has setUseJoysticks enabled.

Doesn’t change a thing :confused:
I also tried creating a new JmeContext, that lead to some Logger Output from extracting natives, but the same behavior as before :frowning:

Edit: Even without creating an Context and simply calling JmeSystem leads to extraction.

Maybe you forgot to call InputManager.update()?

It works now!! Thank you :smile:

It even works without JmeSystem.initialize, but that is possibly because the lib has already been extracted?

Probably. You might still want to call it just to be safe.

1 Like