Hello Guest

[BUG]Mouse.getDX() returns 0;

  • 10 Replies
  • 11662 Views
[BUG]Mouse.getDX() returns 0;
« on: October 24, 2011, 00:47:00 »
The topic says pretty much everything. getDY() returns 0 too.
« Last Edit: October 31, 2011, 10:16:34 by kappa »

*

Offline kappa

  • *****
  • 1313
Re: [MAYBE BUG]Mouse.getDX() returns 0;
« Reply #1 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?

Re: [MAYBE BUG]Mouse.getDX() returns 0;
« Reply #2 on: October 24, 2011, 09:47:02 »
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 :/

Re: [MAYBE BUG]Mouse.getDX() returns 0;
« Reply #3 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.

Re: [MAYBE BUG]Mouse.getDX() returns 0;
« Reply #4 on: October 24, 2011, 22:18:59 »
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;

Re: [BUG]Mouse.getDX() returns 0;
« Reply #5 on: February 21, 2012, 21:20:37 »
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.

*

Offline Matzon

  • *****
  • 2242
Re: [BUG]Mouse.getDX() returns 0;
« Reply #6 on: February 21, 2012, 21:37:00 »
congratulations - you've acquired a mouse that shows the problem. Now debug it for us and provide a patch  :-*

*

Offline princec

  • *****
  • 1929
    • Puppygames
Re: [BUG]Mouse.getDX() returns 0;
« Reply #7 on: February 21, 2012, 22:12:55 »
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 :)

*

Offline Matzon

  • *****
  • 2242
Re: [BUG]Mouse.getDX() returns 0;
« Reply #8 on: February 21, 2012, 22:41:16 »
I think there could be an issue with this .. theoretically ... for people with the issue, does it also happen on sync(60) ?

Re: [BUG]Mouse.getDX() returns 0;
« Reply #9 on: April 15, 2012, 13:32:02 »
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)
« Last Edit: April 15, 2012, 15:07:00 by sliders_alpha »

Re: [BUG]Mouse.getDX() returns 0;
« Reply #10 on: April 06, 2015, 20:04:52 »
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.