Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to put together a game for Mac OS X which involves a lot of fast action and flinging around of the mouse cursor. If the user wants to play in windowed mode, I'd quite like to lock the cursor to the inside of the window to avoid accidentally changing programs in the heat of battle (obviously this will cancel itself if the user changes programs or hits escape for the pause menu.)

On Windows, this can be accomplished easily with ClipCursor(). I can't find an equivalent on Mac OS X. Is there one?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

Have a look at CGWarpMouseCursorPosition, CGAssociateMouseAndMouseCursorPosition and CGGetLastMouseDelta (part of ApplicationServices).

See http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...