fixed an issue where calling setCursorVisible on the ChaseCameraAppstate before it's initialized was causing an NPE.

experimental
Nehon 10 years ago
parent 505ebd0e6b
commit 7c41355cca
  1. 3
      jme3-core/src/main/java/com/jme3/app/ChaseCameraAppState.java

@ -127,6 +127,7 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
initTogleRotateInput(); initTogleRotateInput();
inputManager.addListener(this, inputs); inputManager.addListener(this, inputs);
inputManager.setCursorVisible(dragToRotate);
} }
public void onAction(String name, boolean keyPressed, float tpf) { public void onAction(String name, boolean keyPressed, float tpf) {
@ -429,8 +430,10 @@ public class ChaseCameraAppState extends AbstractAppState implements ActionListe
public void setDragToRotate(boolean dragToRotate) { public void setDragToRotate(boolean dragToRotate) {
this.dragToRotate = dragToRotate; this.dragToRotate = dragToRotate;
this.canRotate = !dragToRotate; this.canRotate = !dragToRotate;
if(inputManager != null){
inputManager.setCursorVisible(dragToRotate); inputManager.setCursorVisible(dragToRotate);
} }
}
/** /**
* invert the vertical axis movement of the mouse * invert the vertical axis movement of the mouse

Loading…
Cancel
Save