Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

XNA Framework Changes in XNA Game Studio 2.0

XNA Game Studio 2.0
A summary of API changes in the XNA Framework from XNA Game Studio Express to XNA Game Studio.

The following list identifies XNA Framework changes by namespace. For a list of new features, see What's New in This Release. Common migration scenarios are covered in Upgrade Guide: XNA Game Studio Express to XNA Game Studio 2.0.

Microsoft.Xna.Framework (Application Model)

Class/TypeAction TakenBreakingWorkaround/Benefit
Game.LoadGraphicsContent and Game.UnloadGraphicsContentDeprecatedNoUse LoadContent and UnloadContent. The deprecated methods will still be called in XNA Game Studio 2.0 but may be removed in future versions.
Game.GraphicsDeviceAddedNoCan be used to access the active GraphicsDevice directly from a Game object.
Game.ContentAddedNoCan be used to access the active ContentManager associated with a Game object.
Game.ResetElapsedTimeAddedNoCan be used to prevent a "stutter" when completing an operation that lags gameplay significantly.
DrawableGameComponent.LoadGraphicsContent and DrawableGameComponent.UnloadGraphicsContent DeprecatedNo Use LoadContent and UnloadContent. The deprecated methods will still be called in XNA Game Studio 2.0 but may be removed in future versions.
DrawableGameComponent.GraphicsDevice Added No Can be used to access the active GraphicsDevice directly from a DrawableGameComponent" object.
GameComponent.Game AddedNoCan now access the Game object associated with a GameComponent instance.
GameComponentCollection AddedNo Can now construct a GameComponentCollection to hold GameComponent objects.
GraphicsDeviceInformation.CreationOptionsRemovedYesIt is no longer necessary to manually recreate a GraphicsDevice.

Microsoft.Xna.Framework (Other)

Class/TypeAction TakenBreakingWorkaround/Benefit
BoundingSphere.TransformAddedNoCan be used to translate a BoundingSphere from object space to world space.
Matrix.CreateWorldAddedNoCan be used to create a world transform Matrix given a position vector and two orientation vectors.
Vector2.ReflectAddedNoCan be used to calculate a reflection Vector2 given a source vector and a normal vector.


Class/TypeAction TakenBreakingWorkaround/Benefit
SoundBank.PlayCue Added overloadNo Overload takes an AudioListener and AudioEmitter to allow playing of 3D audio without having to hold onto a Cue object.
InstancePlayLimitExceptionRemovedYesIt is no longer necessary to catch this exception - playing a Cue above its specified instance limit will silently fail rather than throw an exception.


New namespace for XNA Game Studio 2.0, see Microsoft.Xna.Framework.GamerServices.


Class/TypeAction TakenBreakingWorkaround/Benefit
ResourceUsageRemovedYesMethods that take ResourceUsage now take BufferUsage or TextureUsage. See below for methods that have been changed.
DisplayMode.AspectRatioAddedNoCan be used to retrieve the aspect ratio of a DisplayMode, useful in Xbox 360 programming.
DynamicVertexBuffer and DynamicIndexBuffer AddedNo Can be used for vertex and index buffers that you expect will be changed continuously. See Dynamic Vertex Buffers in XNA. Note that you must hook and respond to the DynamicVertexBuffer.ContentLost and DynamicIndexBuffer.ContentLost if you choose to use dynamic vertex and index buffers.
VertexBuffer.SetData and IndexBuffer.SetDataChangedYesDoes not take a SetDataOptions parameter. Dynamic vertex and index buffer setting can be accomplished using DynamicVertexBuffer and DynamicIndexBuffer objects.
VertexBuffer.ResourceUsage and IndexBuffer.ResourceUsage ChangedYes Replaced with VertexBuffer.BufferUsage and IndexBuffer.BufferUsage
VertexBuffer.ResourceManagementMode and IndexBuffer.ResourceManagementMode RemovedYes Resource management in non-dynamic vertex and index buffers is automatically handled.
Effect.Lost and Effect.Reset eventsRemovedYesEffects will now handle device reset and lost events automatically.
GraphicsAdapter.IsWideScreenAddedNoCan be used to determine if the adapter is displaying in wide screen mode. Useful for Xbox 360 programming.
GraphicsAdapter.CheckDeviceFormatChangedYesNow takes a TextureUsage parameter instead of a ResourceUsage parameter.
GraphicsDevice.ResetAdded overloadNoYou can now call Reset with a new GraphicsAdapter, useful in multi-monitor scenarios.
GraphicsDevice.ResolveBackBufferChangedYes Now takes a ResolveTexture2D instead of a Texture2D. ResolveTexture2D is a type of Texture2D that is configured to hold render target data.
GraphicsDeviceCapabilities.NumberSimultaneousRenderTargetsRenamedNo Renamed to MaxSimultaneousRenderTargets.
PrimitiveCaps.SupportsClipPlaneScaledPoints, PrimitiveCaps.SupportsPerStageConstant, PrimitiveCaps.SupportsTextureStageStateArgumentTempRemovedYes Removed, as these are fixed-function pipeline-related capabilities flags and are unsupported in programmable-pipeline primitives.
GraphicsDeviceCreationParameters.CreationOptionsRemovedYes Removed, as it is no longer necessary to manually recreate a device.
OcclusionQueryAddedNo Can be used in draw testing using occlusion queries, which test whether pixels from draw calls were actually rendered to the screen. See OcclusionQuery for an example.
RenderTarget.RenderTargetUsage AddedNo Can be used to control whether render target contents are preserved or discarded each frame.
RenderTarget.ResourceManagementMode RemovedYes Removed, it is no longer necessary to manually manage resources of a RenderTarget.
ResolveTexture2D AddedYes Can be used to hold the contents of a RenderTarget. You will only need to construct this manually when calling GraphicsDevice.ResolveBackBuffer.
Texture2D, Texture3D, TextureCube constructors ChangedYes Now takes TextureUsage instead of ResourceUsage.
Viewport.AspectRatio AddedNo Can be used to retrieve the aspect ratio of a Viewport, useful in setting up projection matrices.


Class/TypeAction TakenBreakingWorkaround/Benefit
GamePadState.IsButtonUp and GamePadState.IsButtonDownAddedNoCan be used to check multiple button states in the new Buttons enumeration.
GamePadType enumerationChangedNoAdded Guitar and DrumKit types.
Keys enumeration ChangedNo Added Pause value, as well as ChatpadGreen and ChatpadOrange values to support the Chatpad.
Keyboard.GetState Added overloadNo New overload takes a PlayerIndex, used to get input from a Chatpad device connected to the player's controller. PlayerIndex.One corresponds to a plugged-in USB keyboard as well as player one's Chatpad.


New namespace for XNA Game Studio 2.0, see Microsoft.Xna.Framework.Net.


Class/TypeAction TakenBreakingWorkaround/Benefit
BeginShowStorageDeviceGuide and EndShowStorageDeviceGuide MovedYes Moved to the GamerServices namespace, see Guide.BeginShowStorageDeviceSelector and Guide.EndShowStorageDeviceSelector.
ShowStorageDeviceGuideRemovedYesYou may no longer show the device selection guide synchronously. Use Guide.BeginShowStorageDeviceSelector and Guide.EndShowStorageDeviceSelector in the GamerServices namespace.

Community Additions

© 2017 Microsoft