i want to use GameControl and MousebuttonBinding to detect if the left or right MouseButton has been pressed.
GameControl fireWeapon = manager.addControl("Fire Weapon");
fireWeapon.addBinding(new MouseButtonBinding(java.awt.event.MouseEvent.BUTTON1));
Runnable fire = new Runnable() {
public void run() {
System.out.println("Fire!!");
}
};
ActionRepeatController fireWeaponController = new ActionRepeatController(fireWeapon, fireRate, fire);
this.addController(fireWeaponController);
I use the awt MouseEvent to declare the Button1, in awt the MouseButtons are defined as follows:
public static final int NOBUTTON = 0;
public static final int BUTTON1 = 1;
public static final int BUTTON2 = 2;
Now if i press the left mouse button nothing happens, but the action is executed if i press the right button..
It seems jme thinks 0 is the LMB, 1 the RMB.
I guess i just used the wrong Class to define the button number, but i can't figure out how to do that correctly.
Whats is the correct way do define the button number?