2012-03-16 60 views
0

我一直在玩IsFixedTimeStep和TargetElapsedTime,但我無法獲得超過30fps的fps。這是在模擬器和我的HTC HD7手機。WP7上的XNA性能和設置

我試圖讓Farseer中的World.Step()設置正確,但是還沒有爲此找到一個好的設置。

如果我想讓它以60fps的速度運行,那麼三個設置(IsFixedTimeStep,TargetElapsedTime和World.Step)理想情況下應該是什麼?

謝謝!

+0

任何原因你問這個問題兩次,你得到的第一個答案是不好的? - > http://stackoverflow.com/questions/9687009/xna-performance-on-wp7 – 2012-03-16 14:22:10

回答

2

您可以在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); 
    } 

T母雞執行處理程序

void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) 
{ 
    e.GraphicsDeviceInformation.PresentationParameters.PresentationInterval = PresentInterval.One; 
}