gpt4 book ai didi

performance - 如何在没有任何值得计算的事情发生的情况下减少 XNA 游戏 CPU 使用率?

转载 作者:行者123 更新时间:2023-12-03 03:26:20 25 4
gpt4 key购买 nike

新的 XNA 游戏项目应用程序在窗口处于事件状态时会消耗相当多的 CPU 百分比。在我的台式电脑上,它大约是 2 核处理器的 1 个核心的 30%。当窗口失去焦点时,游戏进入空闲模式并消耗约 1% 的 CPU。

在我最近使用 XNA 制作的图像查看器应用程序中,在没有进行图像操作时重绘帧没有多大意义,因此我使用 SuppressDraw() 方法,该方法如下顾名思义,抑制绘制下一帧的资源消耗,而是显示最后绘制的帧。但仍然存在一个问题,即应用程序不断浪费 CPU 来进行非常简单的输入更新。

当 XNA 应用程序不需要太多 CPU 时,如何减少它的 CPU 使用率?

最佳答案

引自this问题

According to this discussion on XBox Live Indie Games forum , apparently on some processors (and OS-s) XNA takes up 100% CPU time on one core when the default value of Game.IsFixedTimeStep is used.

A common solution (one that worked for me as well) is to put the following in your Game constructor:IsFixedTimeStep = false;

更多详情here

关于performance - 如何在没有任何值得计算的事情发生的情况下减少 XNA 游戏 CPU 使用率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16704284/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com