如何将光标锁定在 Mac OS X 上的窗口内部?
我正在尝试为 Mac OS X 制作一款游戏,其中涉及大量快速动作和鼠标光标的快速移动。如果用户想在窗口模式下玩,我很想将光标锁定在窗口内部,以避免在激烈的战斗中意外更改程序(显然,如果用户更改程序或按退出键,这会自行取消)暂停菜单。)
在 Windows 上,可以使用 ClipCursor( )。我在 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 with ClipCursor(). I can't find an equivalent on Mac OS X. Is there one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 CGWarpMouseCursorPosition、CGAssociateMouseAndMouseCursorPosition 和 CGGetLastMouseDelta(ApplicationServices 的一部分)。
请参阅 http://developer.apple.com /library/mac/#documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html
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