While debugging an issue, I decided to run this test code in the act() method of an object in the world:
Running the program and terminal side by side, I noticed that the terminal was flooded with zeros even if I held the mouse button, and would only display a "1" if the mouse was moving while the button was held.
What is the best practice for determining if the button is being held (note: anywhere in the world, so mouseDragged(Actor actor) does not fulfill my needs.
Thanks
1 2 3 | mi = Greenfoot.getMouseInfo(); // repoll the mouse every tick if (mi != null ) { System.out.println(mi.getButton()); } |