Class SpriteAttribute
- Namespace
- GB
- Assembly
- GBSharp.Framework.dll
Converts a sprite sheet into hardware sprite tiles at build time.
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class SpriteAttribute : Attribute
- Inheritance
-
SpriteAttribute
- Inherited Members
Remarks
Sheets are sliced into 8x8 tiles row-major, and flipped duplicates always share one copy because OAM carries flip bits. That row-major order is the order the hardware expects for 8x8 sprites; it is not what TallSprites needs, because hardware 8x16 mode pairs each even tile with the odd tile after it as (top, bottom) of one sprite, and a row-major slice does not put a sprite's top and bottom tiles next to each other. Set TallSprites to get the pairing 8x16 mode requires.
Constructors
SpriteAttribute(string)
public SpriteAttribute(string path)
Parameters
pathstring
Properties
MaxTiles
A tighter tile budget than the hardware's. 0 uses the hardware limit.
public int MaxTiles { get; set; }
Property Value
Path
The image, relative to the declaring file or the Assets folder.
public string Path { get; }
Property Value
TallSprites
Slices the sheet for hardware 8x16 sprites instead of 8x8.
public bool TallSprites { get; set; }
Property Value
Remarks
Each sprite on the sheet must be a 16-pixel-tall column: the sheet's height must be a multiple of 16. The two tiles of a column are placed adjacent and even-aligned, top then bottom, which is what UseTallSprites() needs to draw them as one sprite. Deduplication runs on the pair as a unit so that invariant survives it.