Quads
namespace Griff.Scenes;
public static class QuadsQuads for shapes, belonging to an entity: what Drawing draws with, for code that builds its own lists.
Methods
Section titled “Methods”public static IEnumerable<SpriteDraw> Bar(Entity owner, Vector2 size, BarDirection direction, float fraction, float trail, Color background, Color fill, Color trailColor, BarImages images = default)Quads for a bar of size centered on owner, in its space: the background, then the trail up to trail and the fill up to fraction (both 0 to 1), filling towards direction. Fully transparent parts are left out. With images, the background is its picture (in nine pieces when sliced) and the fill and trail are the fill’s picture, cut off where they end rather than squeezed, all tinted by their colors.
Circle
Section titled “Circle”public static IEnumerable<SpriteDraw> Circle(Entity owner, Vector2 center, float radius, float thickness, Color color, int segments = 20)A ring of segments lines.
public static SpriteDraw Label(Entity owner, string text, Vector2 at, float size, Color color, TextAlign align)A line of text size high at at.
public static SpriteDraw Line(Entity owner, Vector2 from, Vector2 to, float thickness, Color color)A thin quad from one point to another, overlapping by half the thickness at each end so joined lines meet cleanly.
NineSlice
Section titled “NineSlice”public static IEnumerable<ValueTuple<Matrix4x4, Vector4>> NineSlice(Vector2 size, float slice, float border, Vector4 frame, Matrix4x4 space)The quads for a picture stretched to size (centered, in space), and the part of frame (u, v, width, height in 0-1 image space) on each. When slice and border are more than 0 it’s a nine-slice, as a Sliced sprite is: corners, edges and middle, left to right, top to bottom, the outer slice of the picture (up to 0.5) drawn border world units wide (never more than half the size). Otherwise it’s one quad.
Outline
Section titled “Outline”public static IEnumerable<SpriteDraw> Outline(Entity owner, Vector2 center, Vector2 size, float thickness, Color color)The four edges of a rectangle.
public static SpriteDraw Rect(Entity owner, Vector2 center, Vector2 size, Color color, Matrix4x4? space = default)A solid rectangle, in the world or in space.