Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Change Mouse Location

Change Mouse Location
Thread Tools
Fresh-Faced Recruit
Join Date: Feb 2001
Location: OR
Status: Offline
Reply With Quote
Apr 8, 2001, 04:33 PM
 
Is there any way to change the location of the cursor using Cocoa? Let's say you are making a game which you use the mouse to move a space ship. Once it reaches the edge of the screen, the mouse cannot go any further and therefore the spaceship cannot go any further. I need to either set the mouse in the center of the screen after each movement, or else make it loop around the screen. Should I not be using Cocoa to do this? Thanks for any help.

Ryan
     
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status: Offline
Reply With Quote
Apr 9, 2001, 06:00 PM
 
Look in CGDirectDisplay.h at CGDisplayMoveCursorToPoint(CGDirectDisplayID display, CGPoint point); If you can't figure out what a CGDirectDisplayID then take a look at the mode whacker example from Apple. BTW, the coordinate system there is with 0,0 in the upper left and maxX,maxY in the lower right, not the standard Cocoa stuff since these are C functions and not Cocoa. They will work under Cocoa, though. Just include the application services framework to get all of the CG stuff.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:00 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2