如何将光标锁定在Mac OS X上的窗口内?

Zor*_*Hut 10 macos cursor cursor-position

我正在尝试为Mac OS X制作一款游戏,它涉及很多快速动作并且在鼠标光标周围投掷.如果用户想要以窗口模式播放,我非常希望将光标锁定在窗口内部以避免在激烈的战斗中意外更改程序(显然,如果用户更改程序或命中时,这将自行取消暂停菜单.)

在Windows上,这可以通过ClipCursor()轻松完成.我在Mac OS X上找不到同等产品.有吗?

ttv*_*tvd 7

看看CGWarpMouseCursorPosition,CGAssociateMouseAndMouseCursorPosition和CGGetLastMouseDelta(ApplicationServices的一部分).

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