隐藏光标/变形鼠标 (SDL 1.3)
我无法使用 SDL(正确)隐藏鼠标光标。我正在使用 Ubuntu 10.10,并且一直在使用以下内容:
SDL_ShowCursor( SDL_DISABLE );
SDL_WarpMouse( x, y );
两者都无法正常运行;它看起来没有视觉效果,但是正如文档所述,有一个触发的鼠标运动事件,但鼠标不会在屏幕上移动或消失。
SDL 窗口是使用标志 SDL_WINDOW_OPENGL | 创建的(通过 SDL_CreateWindow)。 SDL_WINDOW_SHOWN。全屏对结果没有影响。
在全屏模式下以低分辨率(例如 640x480)运行窗口,确实可以提供命令所需的效果;但光标会从下面的窗口中渗透出来。 在 1024x768 左右,它有一个完全不同的光标图标。 当我的分辨率越来越高时,它就不再渗透,就像一个窗口(Gnome 光标)一样。上述命令没有任何效果。
有什么想法吗?
I've been unable to hide the mouse cursor (properly) using SDL. I am using Ubuntu 10.10 and have been using the following:
SDL_ShowCursor( SDL_DISABLE );
SDL_WarpMouse( x, y );
Neither of which function properly at all; it would appear to have no visual effect, there is however a triggered mouse motion event as the documentation states, but the mouse does not move in any or disappear on screen.
The SDL Window is created (via SDL_CreateWindow) with the flags SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN. Fullscreen has no effect on the outcome.
Running the window at low resolutions in fullscreen mode (such as 640x480), does provide the desired effect of the commands; but the cursor bleeds through from the underlying windows.
Around 1024x768, it has a completely different cursor icon.
As I get higher in resolution, it stops bleeding through and just acts as though its a window (the Gnome cursor). With no effect of above commands.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这个问题很老了,但它仍然是现实的。
解决方法如下:
在你想隐藏光标的地方写下:
在你退出程序的地方:
I know this question is old, but it's still actual.
Here's the solution:
Where you want to hide the cursor, write this:
Where you exit the program:
*是的,SDL 1.3 中尚未实现游标。我故意让它们不被实现,以提醒人们 1.3 还没有准备好。 *
引自 SDL 开发人员 Sam Lantinga;因此这个问题只是一个 SDL bug(很快就会修复)。
*Yes, cursors are not yet implemented in SDL 1.3. I'm sort of intentionally leaving them unimplemented as a reminder that 1.3 isn't ready yet. *
Quote by Sam Lantinga, an SDL Developer; therefore this question is simply an SDL bug (soon to be fixed).