Hi
This is off the top of my head. It almost certainly won't compile, and probably won't run even when you get past that, but it should be along the right lines

.
1 2 3 4 5 6 7 8 9 10 11 12
| Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers(); for(Controller tempController : controllers) { if(tempController.getType()==Controller.Type.MOUSE) { Component xAxis = tempController.getComponents(Component.Identifier.Axis.X); Component yAxis = tempController.getComponents(Component.Identifier.Axis.Y); } } |
You can then poll the device (50 times a second is good otherwise the OS buffers tend to fill up) and then grab the values of those axis.
The other way, is to get just the device like above, then call
on it, poll it every 50th of a second and then call
on the event queue. Each event will have the identifier of the axis it's for and you can just check that for
1
| Component.Identifier.Axis.X |
and
1
| Component.Identifier.Axis.Y |
HTH
Endolf