Why can inputManager.getJoysticks() return null?

I have tested with two gamepads and received null as the result for the method:

inputManager.getJoysticks();

when I launch the JME_Tests (TestJoystick).

I have tested using LibGDX and online services (like: Hardware Tester) - my controllers work correct.

What can be wrong? Maybe there are modern methods to get the array of all conected joysticks?

Thanks!

LWJGL 2 or 3?

…and which version of jMonkeyEngine?

@tonihele
I use SDK and when I select: new Project → JME Tests - there are no GUI for selecting the LWJGL version. I think - default. I use JME 3.6.1

@pspeed
3.6.1 . I’m not sure but I think: SDK Release 3.6.1-sdk2

It is using LWJGL 3. Just change the LWJGL version from the build file. Remove the LWJGL 2 line and enable the LWJGL 3 line.

The SDK uses versioning that matches the engine version it uses.

You also have to enable joysticks on your app settings.

        AppSettings settings = new AppSettings();
        settings.setUseJoysticks(true);
        myApp.setSettings(settings);
1 Like

@fba
This line of code is included “by default” in the TestJoystick.java in JME tests. I have changed nothing.

1 Like

@tonihele

Well, I have created two new projects: one based on LWJGL 3 and one more based on LWJGL 2.
The both work correct.
Only the example from the JME-tests doesn’t work.

Thanks!

That’s weird. So jME-tests is broken with both LWJGL 2 and 3?

@tonihele
Excuse me, right now all works correct (after I created two projects). Maybe some drivers were reinstalled. I don’t know.
Only troubles with text representation for buttons. See screenshot. Left is from default JMETests, right from the new created project:

What is the difference between the two? Code and project setup wise? Both are Gradle projects with Java xx and LWJGL x? Is the code identical? If not, can you post the code from your project? Also what jME version is your project using?

I don’t have any joysticks, I can’t really test anything myself. But surely there is explanation for this…

@tonihele
The left created when I simple create a new project for type: JmeTests. No data about LWJGL version is in the GUI-menu.
The right was created when I simple created a new project and copied the same code in my project.
I have tested on an another PC - there is no problem. I think the trouble was in the encoding: the new PC has a fully US-localisation (Windows 10 x64).

But there is no problem in the wrong glyphs.

I’m amazed that JME3 works perfect with my PS3 Sixaxis. Cool! Right now I have a project in LibGDX and I can not receive callbacks from 5 from 14 buttons of the same gamepad. But JME3 receives all callbacks - perfect!

3 Likes