LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: napier on February 17, 2005, 21:52:20

Title: Mouse UP event repeats when first starting
Post by: napier on February 17, 2005, 21:52:20
Not sure I'm using the Mouse right.  

I modified the demo MouseCreationTest to detect discreet mouse up/down events.  I put this into wiggleMouse() :

           while ( Mouse.next() ) {
               if(Mouse.getEventButton() == 0 && Mouse.getEventButtonState() == false) {
                 System.out.println("MOUSE UP");
               }
               if(Mouse.getEventButton() == 0 && Mouse.getEventButtonState() == true) {
                 System.out.println("MOUSE DOWN");
               }
           }


thinking it will fire MOUSEDOWN only once when mouse is pressed and MOUSEUP once when mouse is released.  

What happens is that this fires MOUSEUP every frame until I click the mouse.  After that it works as I expected (fires MOUSEUP only once when mouse is pressed and released).  Once the test goes into fullscreen mode it again fires MOUSEUP every frame until I click the mouse.  

Do I have to clear the Mouse event buffer before I use it?  Or some other initialization I'm missing?

Running in windows, LW version .95