Added sprite batch settings to maintain sprite batch begin settings and keep consistency and control over settings. Ninepatch uses this.

This commit is contained in:
2019-03-10 00:50:03 -06:00
parent 04ec3cd793
commit 4add103f94
6 changed files with 113 additions and 38 deletions

View File

@@ -0,0 +1,61 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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>
/// 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);
}
}
}