Skip to content

GraphicsAPI reference

Struct DrawOptions

Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Graphics2D.dll
Guide: Graphics

Per-draw sprite options. Origin is in source pixels and is also the rotation pivot.

C#
public readonly struct DrawOptions : IEquatable<DrawOptions>

Implements

IEquatable<DrawOptions>

Constructors

DrawOptions(bool, bool, float, Vector2, Vector2?)

Per-draw sprite options. Origin is in source pixels and is also the rotation pivot.

C#
public DrawOptions(bool FlipX = false, bool FlipY = false, float Rotation = 0, Vector2 Origin = default, Vector2? Scale = null)

Parameters

FlipX bool

Mirrors the sprite horizontally.

FlipY bool

Mirrors the sprite vertically.

Rotation float

Clockwise rotation in radians around Origin.

Origin Vector2

Rotation and scale pivot, in source pixels from the top-left of the source rectangle.

Scale Vector2?

Scale factors per axis; null draws at 1:1.

Fields

None

No flip, rotation or scale: the same as default.

C#
public static readonly DrawOptions None

Field Value

DrawOptions

Properties

FlipX

Mirrors the sprite horizontally.

C#
public bool FlipX { get; init; }

Property Value

bool

FlipY

Mirrors the sprite vertically.

C#
public bool FlipY { get; init; }

Property Value

bool

Origin

Rotation and scale pivot, in source pixels from the top-left of the source rectangle.

C#
public Vector2 Origin { get; init; }

Property Value

Vector2

Rotation

Clockwise rotation in radians around Origin.

C#
public float Rotation { get; init; }

Property Value

float

Scale

Scale factors per axis; null draws at 1:1.

C#
public Vector2? Scale { get; init; }

Property Value

Vector2?

Methods

Deconstruct(out bool, out bool, out float, out Vector2, out Vector2?)

C#
public void Deconstruct(out bool FlipX, out bool FlipY, out float Rotation, out Vector2 Origin, out Vector2? Scale)

Parameters

FlipX bool

FlipY bool

Rotation float

Origin Vector2

Scale Vector2?

Equals(object)

C#
public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(DrawOptions)

C#
public bool Equals(DrawOptions other)

Parameters

other DrawOptions

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(DrawOptions, DrawOptions)

C#
public static bool operator ==(DrawOptions left, DrawOptions right)

Parameters

left DrawOptions

right DrawOptions

Returns

bool

operator !=(DrawOptions, DrawOptions)

C#
public static bool operator !=(DrawOptions left, DrawOptions right)

Parameters

left DrawOptions

right DrawOptions

Returns

bool