[BUG]Mouse.getDX() returns 0;

Started by Caironater, October 24, 2011, 00:47:00

Previous topic - Next topic

Caironater

The topic says pretty much everything. getDY() returns 0 too.

kappa

That sounds like normal behaviour, it should only change when moving the mouse and will report the movement of the mouse since the last type Mouse.getDX() was called, so if it doesn't move it will be 0. Maybe you need Mouse.getX() instead?

Caironater

Quote from: kappa on October 24, 2011, 08:52:58
That sounds like normal behaviour, it should only change when moving the mouse and will report the movement of the mouse since the last type Mouse.getDX() was called, so if it doesn't move it will be 0. Maybe you need Mouse.getX() instead?

I'm moving the mouse.
But, seeing as I couldn't get it to work, I've just decided to use mouseX - prevMouseX instead :/

avm1979

You're not on a Mac by any chance, are you? I noticed that Mouse.getDX()/Mouse.getDY() worked fine on Windows and Linux, but always returned zero in OSX.

Actually, I don't 100% remember it was always 0 - I think it actually *wasn't*. It was usually 0, but occasionally you'd get some non-zero values, enough to make things twitch. Was about 2 years ago, so it's hard to remember exactly :) I do remember having to switch away from using it, though.

Caironater

Quote from: avm1979 on October 24, 2011, 16:41:00
You're not on a Mac by any chance, are you? I noticed that Mouse.getDX()/Mouse.getDY() worked fine on Windows and Linux, but always returned zero in OSX.

Actually, I don't 100% remember it was always 0 - I think it actually *wasn't*. It was usually 0, but occasionally you'd get some non-zero values, enough to make things twitch. Was about 2 years ago, so it's hard to remember exactly :) I do remember having to switch away from using it, though.

Nah, I'm using Windows 7 + LWJGL 2.8.1;

gutomarzagao

I'm using Windows 7 and getting the same problem.
And it's not always 0. If I move the mouse as fast as I can, it returns some values.

Matzon

congratulations - you've acquired a mouse that shows the problem. Now debug it for us and provide a patch  :-*

princec

I wonder if running a loop as fast as possible - eg. for (;;) { Display.update(); } - on a grabbed mouse in Windows wouldn't actually be expecting this behaviour, actually, having just been monkeying around in the code. The mouse is recentered every update(), which if you're running it at 1600Hz, means it probably never gets to move, and the movement is how we currently get the delta values.

I think we need a better way to get mouse deltas than this.

I seem to recall a long time ago when I first had JGLIB/LWJGL early alphas we used DirectInput for the mouse. Maybe we should look into using it again for delta values on Windows.

Cas :)

Matzon

I think there could be an issue with this .. theoretically ... for people with the issue, does it also happen on sync(60) ?

sliders_alpha

I'm having the same bug D:

I'm under windows7 64b and using eclipse 32b with the last LWJGL.
it doesn't matter how fast I move the mouse it never returns anything.

It does happen on sync(60)

mighty_archemedes

I'm running into the same issue on Ubuntu Mate 15.04. It almost looks like something is being accidentally cast to an int and floored to zero somewhere. In the meanwhile, my workaround is to store each mouse position (which does update properly) in a record variable, and then determine the differential, each refresh, with a function or a binding.