Batch2D

Namespace: Murder.Core.Graphics
Assembly: Murder.dll

public class Batch2D : IDisposable

Implements: IDisposable

⭐ Constructors

public Batch2D(string name, GraphicsDevice graphicsDevice, Effect effect, BatchMode batchMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, bool autoHandleAlphaBlendedSprites)

Parameters
name string
graphicsDevice GraphicsDevice
effect Effect
batchMode BatchMode
blendState BlendState
samplerState SamplerState
depthStencilState DepthStencilState
rasterizerState RasterizerState
autoHandleAlphaBlendedSprites bool

public Batch2D(string name, GraphicsDevice graphicsDevice, bool followCamera, Effect effect, BatchMode batchMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, bool autoHandleAlphaBlendedSprites)

Parameters
name string
graphicsDevice GraphicsDevice
followCamera bool
effect Effect
batchMode BatchMode
blendState BlendState
samplerState SamplerState
depthStencilState DepthStencilState
rasterizerState RasterizerState
autoHandleAlphaBlendedSprites bool

⭐ Properties

AllowIBasicShaderEffectParameterClone

public bool AllowIBasicShaderEffectParameterClone { get; public set; }

Returns
bool

AutoHandleAlphaBlendedSprites

public bool AutoHandleAlphaBlendedSprites { get; private set; }

Auto handle any non-opaque (i.e. with some transparency; Opacity < 1.0f) sprite rendering. By drawing first all opaque sprites, with depth write enabled, followed by non-opaque sprites, with only depth read enabled.

Returns
bool

BatchMode

public readonly BatchMode BatchMode;

Returns
BatchMode

BlendState

public readonly BlendState BlendState;

Returns
BlendState

DepthStencilState

public readonly DepthStencilState DepthStencilState;

Returns
DepthStencilState

Effect

public Effect Effect { get; public set; }

Returns
Effect

GraphicsDevice

public GraphicsDevice GraphicsDevice { get; public set; }

Returns
GraphicsDevice

IsBatching

public bool IsBatching { get; private set; }

Returns
bool

IsDisposed

public bool IsDisposed { get; private set; }

Returns
bool

Name

public string Name;

Returns
string

RasterizerState

public readonly RasterizerState RasterizerState;

Returns
RasterizerState

SamplerState

public readonly SamplerState SamplerState;

Returns
SamplerState

SpriteCount

public static int SpriteCount { get; private set; }

Sprite count at current buffer.

Returns
int

StartBatchItemsCount

public static const int StartBatchItemsCount;

Returns
int

TotalDrawCalls

public static int TotalDrawCalls { get; private set; }

Track number of draw calls.

Returns
int

TotalItemCount

public int TotalItemCount { get; }

Returns
int

TotalTransparentItemCount

public int TotalTransparentItemCount { get; }

Returns
int

Transform

public Matrix Transform { get; private set; }

Returns
Matrix

⭐ Methods

Dispose()

public virtual void Dispose()

Immediately releases the unmanaged resources used by this object.

Begin(Matrix)

public void Begin(Matrix cameraMatrix)

Parameters
cameraMatrix Matrix

Draw(Texture2D, Vector2, Vector2, Rectangle, float, float, Vector2, ImageFlip, Color, Vector2, Vector3)

public void Draw(Texture2D texture, Vector2 position, Vector2 targetSize, Rectangle sourceRectangle, float sort, float rotation, Vector2 scale, ImageFlip flip, Color color, Vector2 offset, Vector3 blendStyle)

Draw a sprite to this sprite batch.

Parameters
texture Texture2D

position Vector2

targetSize Vector2

sourceRectangle Rectangle

sort float

rotation float

scale Vector2

flip ImageFlip

color Color

offset Vector2

blendStyle Vector3

Exceptions
InvalidOperationException

DrawPolygon(Texture2D, ImmutableArray, DrawInfo)

public void DrawPolygon(Texture2D texture, ImmutableArray<T> vertices, DrawInfo drawInfo)

Parameters
texture Texture2D
vertices ImmutableArray<T>
drawInfo DrawInfo

DrawPolygon(Texture2D, Vector2[], DrawInfo)

public void DrawPolygon(Texture2D texture, Vector2[] vertices, DrawInfo drawInfo)

Parameters
texture Texture2D
vertices Vector2[]
drawInfo DrawInfo

End()

public void End()

Flush(bool)

public void Flush(bool includeAlphaBlendedSprites)

Send all stored batches to rendering, but doesn't end batching. If auto handle alpha blended sprites is active, be careful! Since it can includes alpha blended sprites too.

Parameters
includeAlphaBlendedSprites bool

GiveUp()

public void GiveUp()

Similar to Batch2D.End but without actually drawing the batch

SetTransform(Vector2, Vector2)

public void SetTransform(Vector2 position, Vector2 scale)

Parameters
position Vector2
scale Vector2

SetTransform(Vector2)

public void SetTransform(Vector2 position)

Parameters
position Vector2