Table of Contents

Struct SpriteDrawOptions

Namespace
BSGameLib.Game.Rendering
Assembly
BSGameLib.Game.dll

Immutable description of a sprite draw request.

public readonly record struct SpriteDrawOptions : IEquatable<SpriteDrawOptions>
Implements
Inherited Members

Constructors

SpriteDrawOptions(ITexture, Rectangle, Rectangle?, Color, RenderFlip, float, Vector2, Vector2, Material, int)

Creates a sprite draw. A sourceRectangle that is null or zero-sized draws the whole texture, or the region of the parent when texture is a SubTexture.

public SpriteDrawOptions(ITexture texture, Rectangle destinationRectangle, Rectangle? sourceRectangle = null, Color color = default, RenderFlip flip = RenderFlip.None, float rotation = 0, Vector2 origin = default, Vector2 scale = default, Material material = default, int zIndex = 0)

Parameters

texture ITexture
destinationRectangle Rectangle
sourceRectangle Rectangle?
color Color
flip RenderFlip
rotation float
origin Vector2
scale Vector2
material Material
zIndex int

Exceptions

ArgumentNullException

texture is null.

Properties

Color

The colour the texture is tinted with. White, which applies no tint, when not given.

public Color Color { get; }

Property Value

Color

DestinationRectangle

Where the sprite is drawn, and at what size, in the coordinates the projection maps.

public Rectangle DestinationRectangle { get; }

Property Value

Rectangle

Flip

Whether the sprite is mirrored horizontally, vertically, or both.

public RenderFlip Flip { get; }

Property Value

RenderFlip

Material

The material the sprite is drawn with. Unlit when not given.

public Material Material { get; }

Property Value

Material

Origin

The point the sprite is rotated and scaled about.

public Vector2 Origin { get; }

Property Value

Vector2

Rotation

The rotation of the sprite about Origin, in degrees.

public float Rotation { get; }

Property Value

float

Scale

The scale the sprite is drawn at. (1, 1), which leaves it unscaled, when not given.

public Vector2 Scale { get; }

Property Value

Vector2

SourceRectangle

The part of Texture to draw, in pixels. The whole texture when the source was null or zero-sized.

public Rectangle SourceRectangle { get; }

Property Value

Rectangle

Texture

The texture to draw from. A SubTexture with no source rectangle draws its region of its parent.

public ITexture Texture { get; }

Property Value

ITexture

ZIndex

The order the sprite is drawn in: lower values first, when the batch sorts by it. See SetExternalOrdering(bool).

public int ZIndex { get; }

Property Value

int