recrownedgtk/RecrownedAthenaeum/Render/SpriteBatchSettings.cs

77 lines
2.7 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace RecrownedAthenaeum.Render
{
/// <summary>
/// The settings the sprite batch should use.
/// </summary>
public struct SpriteBatchSettings
{
/// <summary>
/// Defines sprites sort mode.
/// </summary>
public SpriteSortMode spriteSortMode;
/// <summary>
/// The blend state to use.
/// </summary>
public BlendState blendState;
/// <summary>
/// Sampler state to use.
/// </summary>
public SamplerState samplerState;
/// <summary>
/// The depth stencil state to use.
/// </summary>
public DepthStencilState depthStencilState;
/// <summary>
/// The rasterizer state to use.
/// </summary>
public RasterizerState rasterizerState;
/// <summary>
/// The effect to use.
/// </summary>
public Effect effect;
/// <summary>
/// The transformation matrix to use.
/// </summary>
public Matrix? transformMatrix;
/// <summary>
/// See <see cref="SpriteBatch.Begin(SpriteSortMode, BlendState, SamplerState, DepthStencilState, RasterizerState, Effect, Matrix?)"/> for uses and defaults.
/// </summary>
/// <param name="spriteSortMode"></param>
/// <param name="blendState"></param>
/// <param name="samplerState"></param>
/// <param name="depthStencilState"></param>
/// <param name="rasterizerState"></param>
/// <param name="effect"></param>
/// <param name="transformMatrix"></param>
public SpriteBatchSettings(SpriteSortMode spriteSortMode = SpriteSortMode.Deferred, BlendState blendState = null, SamplerState samplerState = null, DepthStencilState depthStencilState = null, RasterizerState rasterizerState = null, Effect effect = null, Matrix? transformMatrix = null)
{
this.spriteSortMode = spriteSortMode;
this.blendState = blendState;
this.samplerState = samplerState;
this.depthStencilState = depthStencilState;
this.rasterizerState = rasterizerState;
this.effect = effect;
this.transformMatrix = transformMatrix;
}
/// <summary>
/// Begins the given sprite batch with the current set of settings.
/// </summary>
/// <param name="spriteBatch">Begins the spritebatch with the given settings.</param>
public void BeginSpriteBatch(SpriteBatch spriteBatch)
{
spriteBatch.Begin(spriteSortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, transformMatrix);
}
}
}