LWJGL
October 30, 2014, 15:51:56 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.9.1 released!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [CLOSED] Clip getEventDY/DX to window.  (Read 3350 times)
Feskmaws
Newbie
*
Posts: 2


« on: November 13, 2011, 16: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 Smiley.
Logged
jediTofu
Prolific Timewaster
****
Posts: 280



« Reply #1 on: November 17, 2011, 20: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
*
Posts: 2


« Reply #2 on: November 28, 2011, 13:32:13 »

I can't get that to work Undecided. 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:
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
*
Posts: 3


WWW
« Reply #3 on: January 27, 2012, 22: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).
Logged

Matzon
Administrator
Demigod
*****
Posts: 2242



« Reply #4 on: January 28, 2012, 01: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?
Logged

kappa
Administrator
Nerdus Imperius
*****
Posts: 1169



« Reply #5 on: May 13, 2012, 07: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
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!