共用方式為


Game.IsFixedTimeStep Property

Gets or sets a value indicating whether to use fixed time steps.

Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework.Game (in microsoft.xna.framework.game.dll)

Syntax

public bool IsFixedTimeStep { get; set; }

Property Value

true if using fixed time steps; false otherwise.

Remarks

The default value for IsFixedTimeStep is true.

A fixed-step Game tries to call its Update method on the fixed interval specified in TargetElapsedTime. Setting Game.IsFixedTimeStep to true causes a Game to use a fixed-step game loop. Using a fixed step allows game logic to use the update as its basic unit of time and assume that Update will be called at the interval specified. When an update runs slower than expected, Game meets this assumption by calling Update extra times and dropping the frames associated with those updates to catch up. This ensures that Update will have been called the expected number of times when the game loop catches up from a slow down.

When using a fixed-step game loop, rates such as the distance a sprite moves can be expressed as game units per Update. This enables you to simply increment the position of the sprite by the sprite's movement rate each Update.

See Also

Tasks

How to: Make a Game Use a Variable Time Step

Concepts

Application Model Overview

Reference

GameTime.IsRunningSlowly Property
Game.TargetElapsedTime Property
Game Class
Game Members
Microsoft.Xna.Framework Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista