LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: laserlars on February 16, 2015, 21:33:49

Title: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
Post by: laserlars on February 16, 2015, 21:33:49
Windows 7

Just upgraded from 2.8.2 to 2.9.3 and I noticed that when running LWJGL with a AWT-canvas the mouse
events always reports 0 for getY() - getX() works fine though. getEventY() doesn't work either - but you will get data if you use getEventDY();
Title: Re: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
Post by: spasi on February 18, 2015, 12:10:37
I cannot reproduce this. Could you post more information or some code? What does your event loop look like? Do you use mouse grabbing?
Title: Re: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
Post by: TaylorR on February 24, 2015, 07:19:24
@laserlars check out http://forum.lwjgl.org/index.php?topic=5471.0 (http://forum.lwjgl.org/index.php?topic=5471.0) 2.9.3 contained a fix for mouse movements. Make sure your mouse reading is looping over all events.

@spasi please correct me on this, but if you use mouse grabbing you are safe to just make the collect call, i.e. getX(), but if you don't use grabbing its your responsibility to collect all input data via event loop, i.e. [LOOP]x += getEventX()[/LOOP]?
Title: Re: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
Post by: spasi on February 24, 2015, 12:02:35
Quote from: TaylorR on February 24, 2015, 07:19:24@spasi please correct me on this, but if you use mouse grabbing you are safe to just make the collect call, i.e. getX(), but if you don't use grabbing its your responsibility to collect all input data via event loop, i.e. [LOOP]x += getEventX()[/LOOP]?

The difference is not related to mouse grabbing. Methods like getX() are just aggregates of the events that have occurred since the last time they were called. An event loop simply gives you the "history" of how you got there.
Title: Re: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
Post by: laserlars on February 25, 2015, 11:05:19
Hi! Sorry for slow reply!

I threw out the code and switched to plain awt graphics 2d as I didn't really do any fancy stuff with GL anyway (just basic 2d) but I'm thinking of rendering again with GL.

I will check my git If I can roll-back. But It was really basic - and what suprised me was the fact that X worked fine but not Y. I will investigate when I get home from work!