Set cursor position?
-
You'd have to use system calls. No SU API methods for such thing.
-
I was afraid of that. Does that mean there would have to be two separate solutions for Mac and PC?
Is there any examples on how it's done? -
Yea - separate method for each platform.
No idea how to do it on OSX.
But on Windows you'd use the Win32API to make a call to SetCursorPos: http://msdn.microsoft.com/en-us/library/ms648394%28VS.85%29.aspx -
-
Pixero, can you share what you're trying to do?
Its generally viewed as bad practice for programs to move mouse cursors rather than allow the user control of interactions. Is there another way of expressing what you want?
Adam
-
@adamb said:
Pixero, can you share what you're trying to do?
Its generally viewed as bad practice for programs to move mouse cursors rather than allow the user control of interactions. Is there another way of expressing what you want?
Adam
I'm writing a Camera Tool that would benefit greatly from not stopping at the edge of the screen when panning.
I'm currently investigating two separate solutions:
A) Keeping the cursor (hidden) centered on screen and get the difference between the mouse position and the center of the screen each frame, then reset the mouse position to the center, like some game engines does. Most likely when onLButtonDown is true so it reappears when onLButtonUp. Giving the user the control of cursor interaction back.
B) Wrapping the cursor when it's at the edge of the screen so it appears at the opposite edge.Both solutions need to be able to set the cursor position though.
Any thoughts?
-
OK, in video games running under Windows, we always go for the former. ie Keep it hidden and centered and generate deltas. potentially getting the root window handle's mouse events also (ie the whole desktop).
However, in the context of a Windowed Application, you might consider a different metaphor. Perhaps look at how GoogleMaps uses a "virtual trackball" in the corner of the display?
Adam
-
@adamb said:
However, in the context of a Windowed Application, you might consider a different metaphor. Perhaps look at how GoogleMaps uses a "virtual trackball" in the corner of the display?
Adam
Ok, but that's not what I want and wouldn't work in this case, simulating how a person looks at a scene, rotating directly in first person view somewhat like with your TourTool mode.
-
Hello pixero.. And thomhom .. I have the same problem. I wonder if what is the code to run this win32api you just mentioned.. I also wanted to set the cursor on the center of the screen all the time even if I move the mouse. Do you have any sample ruby scripts to run this?
-
did you have a look at http://sketchucation.com/pluginstore?pln=InfinitePanOrbit
I did a mac hack to help out with it, is that the kind of thing your after?
john
Advertisement