/**
* <code>MouseLook</code> defines a mouse action that detects mouse movement
- * and converts it into camera rotations and camera tilts.
+ * and converts it into camera rotations and camera tilts. Allows for looking
+ * to be enabled only on button press, as well as defining which button activates
+ * the looking.
*
* @author Mark Powell
* @version $Id$
private InputActionEvent event;
private boolean buttonPressRequired = false;
+
+ private int mouseButtonForRequired = 0;
/**
* Constructor creates a new <code>MouseLook</code> object. It takes the
public void performAction(InputActionEvent evt) {
float time = 0.01f * speed;
- if(!buttonPressRequired || MouseInput.get().isButtonDown(0)) {
+ if(!buttonPressRequired || MouseInput.get().isButtonDown(mouseButtonForRequired)) {
if (mouse.getLocalTranslation().x > 0) {
event.setTime(time * mouse.getLocalTranslation().x);
rotateRight.performAction(event);
}
- public boolean isButtonPressRequired() {
+ /**
+ * @return the mouseButtonForRequired
+ */
+ public int getMouseButtonForRequired() {
+ return mouseButtonForRequired;
+ }
+
+ /**
+ * @param mouseButtonForRequired the mouseButtonForRequired to set
+ */
+ public void setMouseButtonForRequired(int mouseButtonForRequired) {
+ this.mouseButtonForRequired = mouseButtonForRequired;
+ }
+
+ public boolean isButtonPressRequired() {
return buttonPressRequired;
}