Mouse static "get" values, persistent during current logic/draw cycle(?)

Started by moci, January 20, 2012, 12:08:40

Previous topic - Next topic

moci

Hi,

I'm currently working on a 3D editor and am planning on calling the Mouse properties on multiple locations in the code. Because I would like to keep my code as clean and separated as possible.

The problem is that the current implementations of "getXXX" are based on a per call basis. If component A wants to know the delta of X it would call "Mouse.getDX()", if then component B wants to also know the delta of X it will not get the same delta but 0. Because the mouse did not move between the two calls.

It would make sense to keep the delta values (or any other information) persistent during the same cycle. I could easily solve this by using another wrapper around the Mouse object but it would be nice to see this in the library itself.

If my thinking is wrong, please let me know!

Fool Running

Try looking at the Mouse event queue. It basically keeps the values the same until you call Mouse.next(). Look at this example (it's for the Keyboard class, but it applies to the Mouse class as well): http://www.lwjgl.org/wiki/index.php?title=LWJGL_Basics_2_(Input)
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D