LWJGL

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [CLOSED] Clip getEventDY/DX to window.  (Read 3505 times)

Feskmaws

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
[CLOSED] Clip getEventDY/DX to window.
« on: November 14, 2011, 00:51:31 »

Hello.

I'm working on an application which includes dragging windows inside the display (all done in OpenGL). When I hold down either mouse button and move outside the window, the getEventDX/DY functions returns the real values for mouse movement, but I think it would make more sense if they returned the difference between the clipped coordinates for the mouse event, at least when Mouse.setClipMouseCoordinatesToWindow(true) is set. Alternatively, an option for this kind of behaviour would be nice :).
Logged

jediTofu

  • Prolific Timewaster
  • ****
  • Offline Offline
  • Posts: 280
Re: [RFE] Clip getEventDY/DX to window.
« Reply #1 on: November 18, 2011, 04:18:00 »

Would "org.lwjgl.input.Mouse.allowNegativeMouseCoords" solve this?

http://www.lwjgl.org/wiki/index.php?title=LWJGL_Hidden_Switches
Logged
cool story, bro

Feskmaws

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
Re: [RFE] Clip getEventDY/DX to window.
« Reply #2 on: November 28, 2011, 21:32:13 »

I can't get that to work :-\. When I try having it in a static block, it says it can't find the field, and when I try passing it as VM arguments it can't find the main class. This might very likely be a problem on my end since I'm not very good with this aspect of java developing.

Anyway, since setClipMouseCoordinatesToWindow() should already do what I understand org.lwjgl.input.Mouse.allowNegativeMouseCoords is meant to do and more, it probably isn't enough.

I checked the values for X, DX, Y and DY with the following lines everytime a mouse event occured:

Code: [Select]
System.out.println("X = " + Mouse.getEventX() + " Y = " + Mouse.getEventY());
System.out.println("DX = " + Mouse.getEventDX() + " DY = " + Mouse.getEventDY());

When moving the mouse below and to the left of the window, X and Y are both 0, but DX and DY are not. Again, it only behaves like this when either mouse button is held down since it doesn't generate events otherwise.
Logged

noblemaster

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
Re: [RFE] Clip getEventDY/DX to window.
« Reply #3 on: January 28, 2012, 06:23:59 »

I am having the same problem. I tried both setClipMouseCoordinatesToWindow(...) and org.lwjgl.input.Mouse.allowNegativeMouseCoords but I am only able to get coordinates outside the window (including negative coordinates) when the mouse button is pressed, i.e. for dragging.

Would it be possible to get coordinates for when the mouse is outside the window even if the mouse buttons are not pressed? Maybe there is an option/setting we are not aware of?

To bring it into context: getting the mouse coordinates outside the window is important for left/right/up/down scrolling of an isometric map (e.g. ala Age of Empires). It's difficult to decide where to scroll the isometric map if I am not sure what position outside the window the mouse has (windowed mode).

Matzon

  • Administrator
  • Demigod
  • *****
  • Offline Offline
  • Posts: 2242
Re: [RFE] Clip getEventDY/DX to window.
« Reply #4 on: January 28, 2012, 09:03:32 »

Technically, on windows, it's impossible to get mouse movement events outside the window unless we create a system hook. I dont think we plan on doing that. I think there are some anti-virus programs that react to that.

Why not just grab the cursor and draw your own?

kappa

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1203
Re: [RFE] Clip getEventDY/DX to window.
« Reply #5 on: May 13, 2012, 14:20:15 »

I don't think the getEventDX() and getEventDY() behaviour here is wrong or should be changed as per the RFE. The DX and DY values simply reflect the amount the mouse has moved and therefore shouldn't be effected by any mouse coordinate clipping.

The behaviour the Op is looking for can be obtained by using getX(), getY() (or getEventX() and getEventY()) and calculating your own DX, DY values with checks on windows bounds to get the special outside window behaviour Op needs.
Logged