Setting the mouse location
Does anyone know of a way to have a program set the mouse location in C? The LMSetMouseLocation function in LowMem.h has been phased out in Carbon, and the Apple page says that it is impossible for an application to change the mouse location directly.
Background: I'm trying to program a Crystal-quest style mouse control for a game. Basically, to do that control style:
Store the location of the mouse
If the mouse moves, accelerate your ship in that direction
Store the new location of the mouse
So basically, moving the cursor accelerates in the direction that you moved it in. It's very intuitive, but the problem is that the cursor can end up moved all the way to one side of the screen, and will move no farther. So the work-around is to re-center the mouse each frame...
Background: I'm trying to program a Crystal-quest style mouse control for a game. Basically, to do that control style:
Store the location of the mouse
If the mouse moves, accelerate your ship in that direction
Store the new location of the mouse
So basically, moving the cursor accelerates in the direction that you moved it in. It's very intuitive, but the problem is that the cursor can end up moved all the way to one side of the screen, and will move no farther. So the work-around is to re-center the mouse each frame...
Search the forums, this has been answered before.
You should really use absolute mouse deltas rather than moving the mouse.
You should really use absolute mouse deltas rather than moving the mouse.
Look in the CoreGraphics headers. its all in there.
Yup core graphics...
CGDirectDisplay.h
CGDisplayErr CGDisplayMoveCursorToPoint(CGDirectDisplayID display, CGPoint point)
I think I can get you an example of that in use...
CGDirectDisplay.h
CGDisplayErr CGDisplayMoveCursorToPoint(CGDirectDisplayID display, CGPoint point)
I think I can get you an example of that in use...
http://www.geocities.com/ed72678954/index.html
Download JellyMouse and Space Goon (Just get Space Goon because its 1/10cool).
Download JellyMouse and Space Goon (Just get Space Goon because its 1/10cool).
OMG, someone with the same idea as me. A little competition doesn't hurt, but this looks doubtful...
Here is the thread
Here is the thread
"When you dream, there are no rules..."
Well I just had to post this solution, after just spending about 8 hours trying to figure out the same thing. Now if anyone looks at this post they might have an easier way of setting the mouse position.
CGPoint pos;
CGSetLocalEventsSuppressionInterval(0);
CGWarpMouseCursorPosition(pos);
I'm trying to port the gameTutorials SDL openGL tutorials to Cocoa. Very good learning experience.
CGPoint pos;
CGSetLocalEventsSuppressionInterval(0);
CGWarpMouseCursorPosition(pos);
I'm trying to port the gameTutorials SDL openGL tutorials to Cocoa. Very good learning experience.
Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| ending location from angle and speed | Kazooless | 5 | 3,935 |
Apr 3, 2009 02:40 PM Last Post: Gillissie |
|
| polling mouse location? | alloca | 1 | 2,213 |
Jan 22, 2009 04:14 PM Last Post: ThemsAllTook |
|
| Cocoa: Mouse location while dragging window | Fenris | 4 | 4,498 |
Jul 14, 2005 04:46 PM Last Post: Fenris |
|
| Getting mouse location | Steven | 25 | 7,451 |
Aug 3, 2003 07:24 PM Last Post: OneSadCookie |
|
| mouse location woes | kelvin | 4 | 4,348 |
Dec 6, 2002 05:50 PM Last Post: wally |
|

