Class AssetAttribute
- Namespace
- GB
- Assembly
- GBSharp.Framework.dll
Converts an image into tiles at build time and places the result in ROM.
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class AssetAttribute : Attribute
- Inheritance
-
AssetAttribute
- Inherited Members
Remarks
The field itself holds nothing. The image is decoded, validated, converted to 2bpp, deduplicated and turned into ROM data while the project is building, and the field becomes a name for that data. Anything wrong with the image is a compile error pointing at this declaration.
Paths resolve relative to the file that declares them, then to the project's
Assets folder, then to the project root.
[Asset("forest.png")]
private static TileMap Forest;
Constructors
AssetAttribute(string)
public AssetAttribute(string path)
Parameters
pathstring
Properties
DedupeFlips
Whether tiles that are mirrors of each other should share one copy.
public bool DedupeFlips { get; set; }
Property Value
Remarks
Only possible where something can record the flip. On Game Boy Color the attribute map carries flip bits and this defaults to on; an original Game Boy's map has one byte per cell and no room for them, so it defaults to off and turning it on is an error rather than a silently wrong image.
MaxTiles
A tighter tile budget than the hardware's, to fail early. 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; }