getPollData() always returns 0.0

Here is the code :

`ControllerEnvironment ce = ControllerEnvironment.getDefaultEnvironment();
Controller[] controllers = (new DirectInputEnvironmentPlugin()).getControllers();
Controller c = controllers[2];

System.out.println(c.getName());

Axis[] axes = c.getAxes();
Axis X = axes[0];
System.out.println(X.getName());
System.out.println(X.getPollData());`

Wich always returns :

Creating PPJoy Virtual joystick 1 polling = true PPJoy Virtual joystick 1 PPJoy Virtual joystick 1 Axe Z 0.0

The joystick emulator works fine with the Windows game controller panel, it is detected by JInput, but it always returns 0.0. What is happening ?

Hi

Did you compile this jinput build yourself from CVS, or is it from the nightly builds?

What platform are you on?

What device are you detecting?

Does it pick up your mouse/keyboard ok?

Have you checked if there are subcontrollers?, some devices are made up of others.

If all else fails, try the readtest and texttest applications and post the output.

Thanks

Endolf

Um this code looks bad.

You arent suppsoed to instance the plug-in, thats done by JInput inresponse to plug-in discovery.

Look at ReadTest in the source tree for the right way to use the JINput library.

You also need to call poll() on Controller at some point.


Controller c = ...
...
c.poll() 

at some point?

Kev

Wow, now it works. I did’nt knew I had to use poll() before getPollData().

I am using eclipse on windows XP. I don’t remember how I managed to have Jinput working, but I know it was not clean at all. The java build path includes dxinput.jar, jinput.jar, jutils.jar, and a file named dxinput.dll is included in the project root (It would be great to have only one jar on the build path). I downloaded all from the nightly builds because I am unable to use CVS.

Thank you very much for your help.