Class GraphicsExtensions
A set of extensions for dealing with Microsoft.Xna.Framework.Graphics.GraphicsDevice and Microsoft.Xna.Framework.GraphicsDeviceManager
public static class GraphicsExtensions
- Inheritance
-
GraphicsExtensions
- Inherited Members
Methods
ApplyChangesSafely(GraphicsDeviceManager)
Save version of Microsoft.Xna.Framework.GraphicsDeviceManager.ApplyChanges() that doesn't reset window size to defaults
public static void ApplyChangesSafely(this GraphicsDeviceManager manager)
Parameters
managerGraphicsDeviceManagerThe graphics device manager
ResetWidthAndHeight(GraphicsDeviceManager, GameWindow)
Resets preferred width and height back to the window's default bound values.
public static void ResetWidthAndHeight(this GraphicsDeviceManager manager, GameWindow window)
Parameters
managerGraphicsDeviceManagerThe graphics device manager
windowGameWindowThe window whose bounds to use
SetFullscreen(GraphicsDeviceManager, bool)
Sets the graphics device manager to fullscreen, properly taking into account the preferred backbuffer width and height to avoid lower resolutions for higher resolution screens.
public static void SetFullscreen(this GraphicsDeviceManager manager, bool fullscreen)
Parameters
managerGraphicsDeviceManagerThe graphics device manager
fullscreenboolTrue if fullscreen should be enabled, false if disabled
Exceptions
- InvalidOperationException
Thrown when changing out of fullscreen mode before changing into fullscreen mode using this method
WithRenderTarget(GraphicsDevice, RenderTarget2D)
Starts a new GraphicsExtensions.TargetContext using the specified render target.
The returned context automatically disposes when used in a using statement, which causes any previously applied render targets to be reapplied automatically.
public static GraphicsExtensions.TargetContext WithRenderTarget(this GraphicsDevice device, RenderTarget2D target)
Parameters
deviceGraphicsDeviceThe graphics device
targetRenderTarget2DThe render target to apply
Returns
- GraphicsExtensions.TargetContext
The render target context, to be used in a
usingstatement
WithRenderTargets(GraphicsDevice, params RenderTargetBinding[])
Starts a new GraphicsExtensions.TargetContext using the specified render target bindings.
The returned context automatically disposes when used in a using statement, which causes any previously applied render targets to be reapplied automatically.
public static GraphicsExtensions.TargetContext WithRenderTargets(this GraphicsDevice device, params RenderTargetBinding[] targets)
Parameters
deviceGraphicsDeviceThe graphics device
targetsRenderTargetBinding[]The render targets to apply
Returns
- GraphicsExtensions.TargetContext
The render target context, to be used in a
usingstatement