1

I have a program in LWJGL where I have a series of buttons. I'm trying to use Mouse.getEventButton() and Mouse.getEventButtonState() in order to figure out when the mouse is released, but neither seem to be working. After adding a few print statements for debugging, it seems that getEventButton() always returns 0 regardless of what the mouse is doing, and getEventButtonState() always returns false. All other mouse methods I've used so far have behaved normally. Any idea what might be going on?

TomatoMato
  • 703
  • 2
  • 8
  • 19
ApproachingDarknessFish
  • 14,133
  • 7
  • 40
  • 79

1 Answers1

0

It can be done by analogy with keyboard as described in this tutorial.

while (Mouse.next()){
    if (Mouse.getEventButtonState()) {
        if (Mouse.getEventButton() == 0) {
            System.out.println("Left button pressed");
        }
    }else {
        if (Mouse.getEventButton() == 0) {
            System.out.println("Left button released");
        }
    }
}
TomatoMato
  • 703
  • 2
  • 8
  • 19