我一直在玩 IsFixedTimeStep 和 TargetElapsedTime 但我无法获得高于 30fps 的 fps。这在模拟器和我的 HTC HD7 手机上都有。
我也在尝试让 Farseer 中的 World.Step() 设置正确,但还没有找到一个好的设置。
如果我想让它以 60fps 的速度运行,那么三个设置(IsFixedTimeStep、TargetElapsedTime 和 World.Step)应该是什么?
谢谢!
只要你运行的是 Mango Deployed App,你就可以让你的游戏以 60fps 运行
下面的代码摘自:MSDN: Game at 60fps
游戏计时器间隔以 60Hz 运行
timer.UpdateInterval = TimeSpan.FromTicks(166667);
创建事件处理程序
public Game1()
{
graphics = new GraphicsDeviceManager(this);
graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
// Frame rate is 60 fps
TargetElapsedTime = TimeSpan.FromTicks(166667);
}
然后实现处理程序
void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.One;
}