开发者

How can I lock the cursor to the inside of a window on Mac OS X?

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 开发者_如何学Cwith ClipCursor(). I can't find an equivalent on Mac OS X. Is there one?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜