Struct SpriteTable
- Namespace
- GB
- Assembly
- GBSharp.Framework.dll
Indexed access to OAM. Holds no state and occupies no memory.
public struct SpriteTable
- Inherited Members
Fields
Count
The number of hardware sprites. Indices beyond this do nothing.
public const byte Count = 40
Field Value
Properties
this[byte]
A typed view of one sprite. Costs nothing: this lowers to
index itself.
public ref SpriteRef this[byte index] { get; }
Parameters
indexbyte
Property Value
Methods
Hide(byte)
Moves a sprite off screen.
[Native("gbs_sprite_hide")]
public void Hide(byte id)
Parameters
idbyte
HideAll()
Moves every sprite off screen.
[Native("gbs_sprites_hide_all")]
public void HideAll()
Remarks
This is a loop over all 40, not a single register write. Worth doing once at startup; not worth doing every frame.
Load(SpriteAsset)
Loads a converted sprite sheet: its tiles, and on Game Boy Color its palettes.
[Native("gbs_sprite_load")]
public void Load(SpriteAsset sheet)
Parameters
sheetSpriteAsset
LoadTiles(byte, byte, byte[])
Copies sprite tile data into VRAM. 16 bytes per tile.
[Native("gbs_sprite_load_tiles")]
public void LoadTiles(byte firstTile, byte count, byte[] data)
Parameters
Move(byte, byte, byte)
Sets a sprite's position in one call.
[Native("gbs_sprite_move")]
public void Move(byte id, byte x, byte y)
Parameters
Remarks
Scroll(byte, sbyte, sbyte)
Moves a sprite by a relative amount.
[Native("scroll_sprite")]
public void Scroll(byte id, sbyte dx, sbyte dy)
Parameters
SetFlags(byte, SpriteFlags)
Sets all of a sprite's attribute bits at once.
[Native("set_sprite_prop")]
public void SetFlags(byte id, SpriteFlags flags)
Parameters
idbyteflagsSpriteFlags
SetTile(byte, byte)
Sets which tile a sprite draws.
[Native("gbs_sprite_set_tile")]
public void SetTile(byte id, byte tile)