single mouse click

I am using the following code:


while(Mouse.next()) {
  if(Mouse.isButtonDown(0) {
     // do something here
  }
}

sometimes, and only sometimes, that tranlates into sending a bunch of “do something here”'s others it processes a single click. I can test this by click and hold, if my panel opens and closes, it is getting multiple actions, if it opens and stays open, one action (what I want!)
Is there a better or more correct way to get the single click action?

You want:

http://lwjgl.org/javadoc/org/lwjgl/input/Mouse.html#getEventButtonState()

Kev

Great day kev, you camping the forums ;D thansk a bunch, as usual.

4 minutes odd, I’m getting slow :wink:

Kev

I usually just use Mouse.poll(), Mouse.IsButtonPressed(), and a boolean. That way if it wasn’t previously pressed and is now, that’s the initial press, and if it was previously pressed but isn’t now, that’s the release, etc.

Thanks gang…now my type I lasers fire once on click and panels cleanly open and close. 8)