Mouse UP event repeats when first starting

Started by napier, February 17, 2005, 21:52:20

Previous topic - Next topic

napier

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
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl