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
manager
GraphicsDeviceManagerThe 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
manager
GraphicsDeviceManagerThe graphics device manager
window
GameWindowThe 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
manager
GraphicsDeviceManagerThe graphics device manager
fullscreen
boolTrue 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
device
GraphicsDeviceThe graphics device
target
RenderTarget2DThe render target to apply
Returns
- GraphicsExtensions.TargetContext
The render target context, to be used in a
using
statement
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
device
GraphicsDeviceThe graphics device
targets
RenderTargetBinding[]The render targets to apply
Returns
- GraphicsExtensions.TargetContext
The render target context, to be used in a
using
statement