Struct SpriteBatchContext
A sprite batch context is a set of information for a Microsoft.Xna.Framework.Graphics.SpriteBatch to use, which encapsulates all of the information usually passed directly to SpriteBatch.Begin
.
To use a sprite batch context effectively, the extension methods in SpriteBatchContextExtensions should be used.
public struct SpriteBatchContext
- Inherited Members
Constructors
SpriteBatchContext(SpriteSortMode, BlendState, SamplerState, DepthStencilState, RasterizerState, Effect, Matrix?)
Creates a new sprite batch context with the given parameters.
public SpriteBatchContext(SpriteSortMode sortMode = SpriteSortMode.Deferred, BlendState blendState = null, SamplerState samplerState = null, DepthStencilState depthStencilState = null, RasterizerState rasterizerState = null, Effect effect = null, Matrix? transformMatrix = null)
Parameters
sortMode
SpriteSortModeThe drawing order for sprite and text drawing. Microsoft.Xna.Framework.Graphics.SpriteSortMode.Deferred by default.
blendState
BlendStateState of the blending. Uses Microsoft.Xna.Framework.Graphics.BlendState.AlphaBlend if null.
samplerState
SamplerStateState of the sampler. Uses Microsoft.Xna.Framework.Graphics.SamplerState.LinearClamp if null.
depthStencilState
DepthStencilStateState of the depth-stencil buffer. Uses Microsoft.Xna.Framework.Graphics.DepthStencilState.None if null.
rasterizerState
RasterizerStateState of the rasterization. Uses Microsoft.Xna.Framework.Graphics.RasterizerState.CullCounterClockwise if null.
effect
EffectA custom Microsoft.Xna.Framework.Graphics.Effect to override the default sprite effect.
transformMatrix
Matrix?An optional matrix used to transform the sprite geometry. Uses Microsoft.Xna.Framework.Matrix.Identity if null.
Fields
BlendState
State of the blending.
public BlendState BlendState
Field Value
- BlendState
DepthStencilState
State of the depth-stencil buffer.
public DepthStencilState DepthStencilState
Field Value
- DepthStencilState
Effect
A custom Microsoft.Xna.Framework.Graphics.Effect to override the default sprite effect.
public Effect Effect
Field Value
- Effect
RasterizerState
State of the rasterization.
public RasterizerState RasterizerState
Field Value
- RasterizerState
SamplerState
State of the sampler.
public SamplerState SamplerState
Field Value
- SamplerState
SortMode
The drawing order for sprite and text drawing.
public SpriteSortMode SortMode
Field Value
- SpriteSortMode
TransformMatrix
An optional matrix used to transform the sprite geometry.
public Matrix TransformMatrix
Field Value
- Matrix
Methods
Current(GraphicsDevice, SpriteSortMode, Effect, Matrix?)
Creates a new sprite batch context from the passed Microsoft.Xna.Framework.Graphics.GraphicsDevice's current information. This can be useful to retrieve some information about drawing right after a Microsoft.Xna.Framework.Graphics.SpriteBatch.End() call has occured.
public static SpriteBatchContext Current(GraphicsDevice device, SpriteSortMode sortMode = SpriteSortMode.Deferred, Effect effect = null, Matrix? transformMatrix = null)
Parameters
device
GraphicsDeviceThe graphics device to query data from.
sortMode
SpriteSortModeThe drawing order for sprite and text drawing. Microsoft.Xna.Framework.Graphics.SpriteSortMode.Deferred by default.
effect
EffectA custom Microsoft.Xna.Framework.Graphics.Effect to override the default sprite effect.
transformMatrix
Matrix?An optional matrix used to transform the sprite geometry. Uses Microsoft.Xna.Framework.Matrix.Identity if null.
Returns
- SpriteBatchContext
A new sprite batch context from the
device
's current information.