Table of Contents

Class MetaspriteAttribute

Namespace
GB
Assembly
GBSharp.Framework.dll

Converts a sprite sheet into an animated hardware sprite, made of several sub-sprites, at build time.

[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class MetaspriteAttribute : Attribute
Inheritance
MetaspriteAttribute
Inherited Members

Remarks

The sheet is a grid of frames, FrameWidth by FrameHeight tiles each, read left-to-right then top-to-bottom. A frame's own sub-sprites are whichever of its tiles are not entirely transparent (palette index 0, the colour real hardware never draws for a sprite), so a frame does not spend a hardware sprite, ROM, or a runtime OAM write on empty space.

This is a different declaration from SpriteAttribute, not an option on it: a metasprite's frames change the shape of the converted data (a per-frame list of placements, not just a tile array), and making that conditional on an attribute property would be exactly the fragility a fixed argument list is meant to avoid.

Constructors

MetaspriteAttribute(string)

public MetaspriteAttribute(string path)

Parameters

path string

Properties

FrameHeight

One frame's height, in 8-pixel tiles. The sheet's height must be a multiple of this.

public int FrameHeight { get; set; }

Property Value

int

FrameWidth

One frame's width, in 8-pixel tiles. The sheet's width must be a multiple of this.

public int FrameWidth { get; set; }

Property Value

int

MaxTiles

A tighter tile budget than the hardware's. 0 uses the hardware limit.

public int MaxTiles { get; set; }

Property Value

int

Path

The image, relative to the declaring file or the Assets folder.

public string Path { get; }

Property Value

string