C++ / SDL 应用程序在拖动时暂停
遇到谷歌搜索无法帮助我解决的问题。我有一个以 60 fps 运行的小型 SDL 应用程序。一切工作正常,但是,当拖动窗口( 640 X 480 窗口)时,它会暂停/停止运行。是否可以在 SDL 窗口中设置标志或其他内容来防止这种情况发生?或者这是不可避免的?
Came across a problem which google searches could not help me with. I have a little SDL application that runs at 60 fps. Everything is working fine, however, it pauses/stops running when the window is dragged ( 640 X 480 window ). Is there a flag or something that can be set in the SDL window to prevent this from happening? Or is this unavoidable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Windows 使用模态事件循环来拖动窗口,这会阻塞主 UI 线程。
更多讨论(以及建议的解决方法,例如从第二个线程绘图):http://www.sfml-dev.org/forum/viewtopic.php?p=8384&sid=632116a07a569edee43331076e028071
OpenTk 显然有旨在解决这个问题的代码,也许你可以重用一些它:http://www.opentk.com/node/1218
Windows uses a modal event loop for dragging windows, which blocks your main UI thread.
More discussion (and suggested workarounds, such as drawing from a second thread): http://www.sfml-dev.org/forum/viewtopic.php?p=8384&sid=632116a07a569edee43331076e028071
OpenTk apparently has code designed to address this, maybe you can reuse some of it: http://www.opentk.com/node/1218