Skip to content

SpriteDraw

namespace Griff.Scenes;
public struct SpriteDraw

One quad to draw: a unit quad (-0.5..0.5) placed in the world by World, which already includes the sprite’s size and flips. For text, Text is set, the quad is one line high, and the renderer widens it to the rasterized text’s aspect ratio (and shifts it for Align).

public TextAlign Align { get; init; }

For text: where the quad sits relative to the origin. The renderer shifts it once it knows the width.

public Color Background { get; init; }

For text: the color of a box fitted behind its lines by the renderer, which knows how wide they are; transparent draws none (see Background).

public ClipArea? Clip { get; init; }

A part of the world it’s cut to: nothing of it is drawn outside it (a child of a Layout with Clip). Null draws it all.

public Entity Entity { get; init; }
public Color Flash { get; init; }

A color painted over the quad (keeping its shape), with alpha saying how much; see Flash.

public string? Font { get; init; }

For text: the font (see Font), or null for the built-in one.

public float HoleRadius { get; init; }

When more than 0, the quad is drawn in Tint everywhere except a round hole in its middle this big (as a fraction of the quad’s half-width), with no image: the iris of a scene change.

public string? Image { get; init; }
public float Padding { get; init; }

For text with a Background: how far the box reaches past the lines, in lines (the quad’s own units: a Padding over its size).

public Vector4 Source { get; init; }

Part of the image to draw, (u, v, width, height) in 0–1 image space. The whole image by default.

public string? Text { get; init; }
public Color Tint { get; init; }
public int Typed { get; init; }

For text: how many of its characters are drawn, from the start (a typewriter’s); the rest are laid out but not drawn, so the drawn words stay where the whole text puts them. 0 draws them all.

public TextVerticalAlign VerticalAlign { get; init; }

For text: where its lines sit up and down relative to the origin (see VerticalAlign).

public Matrix4x4 World { get; init; }
public float WrapWidth { get; init; }

For text: the width its lines are broken between words to fit, in lines (the quad’s own units: a WrapWidth over its size); 0 breaks them only at new lines.

public void Deconstruct(out Matrix4x4 World, out string? Image, out Color Tint, out Entity Entity, out string? Text)
public override bool Equals(object obj)
public bool Equals(SpriteDraw other)
public override int GetHashCode()
public override string ToString()