Setting Mouse Location

I'd like to propose looking at the ability to set the location of the mouse cursor explicitly.

It would mean implementing the LWJGL setCursorPosition method within LWJGLMouseInput. Something like this:

public void setCursorPosition( int x, int y) {
       Mouse.setCursorPosition( x, y);

And updating MouseInput with an abstract method:

public abstract void setCursorPosition( int x, int y);

AWTMouseInput would have to be updated too to handle this since it derrives from MouseInput. In this case I wouldn't recommend sending a message to handle the move since that would cascade to handle calls, which may not be appropriate.

public void setCursorPosition(int x, int y) {
   absPoint.setLocation( x,y);

The one this that I'm having a hard time figuring out a nice way to do it would be to make sure that the corresponding Textured Quad (Mouse) for something like the AbsoluteMouse would also get the update. Right now I have to make two calls, one to update the position of the cursor as explained above, and another to translate the actual Mouse location.

Suggestions, thoughts, improvments.. etc, are welcome.

I think this idea is very useful. I know that I'm looking to use it right now where I have 2 mouse curors toggle when you click. One is a regular pointer that moves around the screen and then when you click it turns into a grabber cursor, and remains still as you move the mouse, the movements at this point trigger rotation of a Node. Then once they release the mouse I turn the other mouse cursor on, but then the mouse cursor will leap to the new position, I'd like it to remain where it was when I first clicked.

Maybe there's another way to do this, but right now I just wish I could set the mouse position in code.

What is the state of this code is it in the latest CVS, and if not what do you have left to work on, maybe I can help you out.

dougnukem said:

but then the mouse cursor will leap to the new position, I'd like it to remain where it was when I first clicked.

you can call myAbsoluteMouse.setUsingDelta( true ) to avoid this.

I'd like to bring this up again. I've been patching the code every time I update jME to bring this functionality in for myself. It doesn't break any current functionality so I'd like to check it into CVS.

Here's the patch for reference.

### Eclipse Workspace Patch 1.0
#P jme
Index: src/com/jme/input/lwjgl/
RCS file: /cvs/jme/src/com/jme/input/lwjgl/,v
retrieving revision 1.20
diff -u -r1.20
--- src/com/jme/input/lwjgl/   20 Jul 2006 14:21:29 -0000   1.20
+++ src/com/jme/input/lwjgl/   27 Sep 2006 20:53:27 -0000
@@ -246,4 +246,7 @@

Looks pretty non-breaking and enhancing to me… so check it in :slight_smile:

Commited. Thanks.