Mouse Cursor Visiblity

I’m unable to get the mouse cursor to show up, and I’m wondering what I’m missing.



I created a new Basic Game using the code for tutorial 1 (Hello SimpleApplication). I changed simpleInitApp to the following:



[java]

@Override

public void simpleInitApp() {

inputManager.setCursorVisible(true);

Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape at the origin

Geometry geom = new Geometry(“Box”, b); // create cube geometry from the shape

Material mat = new Material(assetManager,

“Common/MatDefs/Misc/Unshaded.j3md”); // create a simple material

mat.setColor(“Color”, ColorRGBA.Blue); // set color of material to blue

geom.setMaterial(mat); // set the cube’s material

rootNode.attachChild(geom); // make the cube appear in the scene

}

[/java]



When I run the app mouse movement works but the cursor is not visible. So what am I missing?



Product Version: jMonkeyEngine SDK 3.0beta

Java: 1.6.0_33; Java HotSpot™ 64-Bit Server VM 20.8-b03

System: Linux version 3.3.7-3.fc17.x86_64 running on amd64; UTF-8; en_US (jmonkeyplatform)



Fedora 17

Xorg 1.12

AMD Radeon HD 7850

AMD Catalyst driver 12.6 (driver packaging version 8.98-120522a-139600E-ATI)

OpenGL version 4.2.11733 Compatibility Profile Context

I tried the same thing on Windows 7 and on Mac OS X (Lion), and also with Java 7. Same results (i.e., no visible cursor). Am I just using the calll incorrectly? I could’ve sworn showing the mouse cursor in this manner worked a couple of months ago (which was the last time I had lesiure to work on my own projects).

Well i’m not sure abou the api, but I can assure you that there is at least one way to make it work on multiple systems. If i rmemeber correctly it was using Mouse.? or Cursor.? (some lwjgl class)



(Cant look at the code right now, in train, but will do so tomorrow, if a solution is not found then)

You can disable the default flycam:

[java]flyCam.setEnabled(false);[/java]



This will show the mouse cursor, but I think you will not be able to rotate the camera anymore. most likely you will have to add this rotation functionality in the analogListener, mapped to one of the mouse buttons.

2 Likes

the flyby camera is overriding your inputManager.setCursorVisible(true);



You can go flyCam.setDragToRotate(true);

3 Likes

Or over-ride the constructor and remove flycam:



[java] public SimpleApplication() {

this( new StatsAppState(), new FlyCamAppState(), new DebugKeysAppState() );

}

[/java]

Remove/add whatever app states you want here.

1 Like

Thanks, guys; I see what was going on, now.