OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
GfxAsset Struct Reference

A tileset bundle: graphics + palette + color depth. More...

#include <asset.h>

Public Attributes

u16 color_mode
 Color depth selector. Use one of: BG_4COLORS, BG_4COLORS0 (Mode 0), BG_16COLORS, BG_256COLORS. Determines how the runtime computes the CGRAM destination from palette_slot.
u8palette
 Pointer to BGR555 palette data.
u8palette_end
 One past the end of the palette data.
u8tiles
 Pointer to tile graphics data.
u8tiles_end
 One past the end of tile graphics. Size is computed at load time as tiles_end - tiles.

Detailed Description

A tileset bundle: graphics + palette + color depth.

Use cases: runtime-built tilemaps, BGs that only ship a tileset without a static map, or any "load tiles + palette" call where you want the asset to be a first-class value (passed to a function, stored in a level table, etc.).

The struct stores begin/end pointer pairs rather than precomputed sizes because pointer subtraction between two extern symbols is not a compile-time constant in C — sizes are computed at load time by gfxLoad(). This keeps the struct usable in static const storage.

Field stability: this struct is part of the public API. New fields may be added at the END only — keep the first five fields where they are. Callers SHOULD use designated initialisers.

Member Data Documentation

◆ color_mode

u16 GfxAsset::color_mode

Color depth selector. Use one of: BG_4COLORS, BG_4COLORS0 (Mode 0), BG_16COLORS, BG_256COLORS. Determines how the runtime computes the CGRAM destination from palette_slot.

◆ palette

u8* GfxAsset::palette

Pointer to BGR555 palette data.

◆ palette_end

u8* GfxAsset::palette_end

One past the end of the palette data.

◆ tiles

u8* GfxAsset::tiles

Pointer to tile graphics data.

◆ tiles_end

u8* GfxAsset::tiles_end

One past the end of tile graphics. Size is computed at load time as tiles_end - tiles.


The documentation for this struct was generated from the following file:
  • /home/runner/work/opensnes/opensnes/lib/include/snes/asset.h