LWJGL
May 23, 2012, 03:51:49 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Mouse static "get" values, persistent during current logic/draw cycle(?)  (Read 289 times)
moci
Newbie
*
Posts: 11


« on: January 20, 2012, 04:08:40 »

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!
Logged
Fool Running
Nerdus Imperius
*****
Posts: 648


« Reply #1 on: January 20, 2012, 05:57:25 »

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)
Logged

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option Grin
Pages: [1]
  Print  
 
Jump to:  

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