In 3.9.0-alpha4 and earlier builds of JME, invoking inputManager.setCursorVisible() has no effect on the position of the mouse cursor.
In 3.9.0-beta1 and 3.9.0-beta2, inputManager.setCursorVisible() causes the cursor to jump to the center of the window.
Here is a test app:
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.Trigger;
public class Main extends SimpleApplication implements ActionListener {
public static void main(String[] args) {
new Main().start();
}
@Override
public void simpleInitApp() {
// Configure the input mapping:
Trigger tabTrigger = new KeyTrigger(KeyInput.KEY_TAB);
String toggleAction = "toggle cursor";
inputManager.addMapping(toggleAction, tabTrigger);
inputManager.addListener(this, toggleAction);
// Pressing the TAB key invokes this.onAction() below.
}
@Override
public void onAction(String string, boolean isPressed, float tpf) {
if (isPressed) { // toggle cursor visibility:
boolean isVisible = inputManager.isCursorVisible();
boolean makeVisible = !isVisible;
inputManager.setCursorVisible(makeVisible);
}
}
}
In 3.9.0-alpha4 and earlier builds of JME, invoking
inputManager.setCursorVisible()has no effect on the position of the mouse cursor.In 3.9.0-beta1 and 3.9.0-beta2,
inputManager.setCursorVisible()causes the cursor to jump to the center of the window.Here is a test app: