PyGame 使 Linux 陷入困境?
当我运行 pygame 代码时,它会使系统陷入困境。 PyGame 变得无响应,并且它使 Ubuntu 速度变慢,以至于我不得不强制关闭两次。
我在这里发布了一个非常相似的问题: 为什么我的基本 PyGame 模块这么慢?
但我决定重新表述一下,因为当我问原来的问题时,我不知道完整的症状。
When I run my pygame code it bogs down the system. PyGame becomes unresponsive and it slows down Ubuntu so much that I've had to force a shut down twice.
I posted a very similar question here:
Why is my basic PyGame module so slow?
but I decided to rephrase it because when I asked the original question I wasn't aware of the full symptoms.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您决定使用您接受的答案中建议的延迟,您可能想要限制 FPS 而不是仅仅施加恒定的延迟。这样做可以确保您的游戏在慢速和快速计算机上以相同的速度运行,并且不会在 CPU 密集型游戏过程中不必要地延迟自身。您还希望将增量时间应用于任何物理/运动计算。
If you decide to use a delay like suggested in the answer you accepted, you probably want to limit your FPS rather than just impose a constant delay. Doing so would ensure that your game runs at the same speed on both slow and fast machines, and doesn't delay itself needlessly during CPU intensive moments of game play. You'd also want to apply your delta time to any physics/movement calculations.
你应该限制fps,你可以使用clock.tick
You should limit the fps, you can use clock.tick for that