OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
asset.h
Go to the documentation of this file.
1
75
76#ifndef SNES_ASSET_H
77#define SNES_ASSET_H
78
79#include <snes/types.h>
80#include <snes/background.h>
81#include <snes/dma.h>
82
119
139
150void gfxLoad(u8 bg, const GfxAsset *asset, u8 palette_slot, u16 tiles_vram);
151
165void bgLoad(u8 bg, const BgAsset *asset, u8 palette_slot,
166 u16 tiles_vram, u16 map_vram);
167
180#define DECLARE_GFX_ASSET(name, color_mode_) \
181 extern u8 name##_tiles[], name##_tiles_end[]; \
182 extern u8 name##_pal[], name##_pal_end[]; \
183 static const GfxAsset name = { \
184 .tiles = name##_tiles, \
185 .tiles_end = name##_tiles_end, \
186 .palette = name##_pal, \
187 .palette_end = name##_pal_end, \
188 .color_mode = (color_mode_), \
189 }
190
202#define DECLARE_BG_ASSET(name, color_mode_, map_size_) \
203 extern u8 name##_tiles[], name##_tiles_end[]; \
204 extern u8 name##_pal[], name##_pal_end[]; \
205 extern u8 name##_map[], name##_map_end[]; \
206 static const BgAsset name = { \
207 .gfx = { \
208 .tiles = name##_tiles, \
209 .tiles_end = name##_tiles_end, \
210 .palette = name##_pal, \
211 .palette_end = name##_pal_end, \
212 .color_mode = (color_mode_), \
213 }, \
214 .tilemap = name##_map, \
215 .tilemap_end = name##_map_end, \
216 .map_size = (map_size_), \
217 }
218
219#endif /* SNES_ASSET_H */
void gfxLoad(u8 bg, const GfxAsset *asset, u8 palette_slot, u16 tiles_vram)
Load a tileset (tiles + palette) and configure a BG's tile graphics pointer — typed-value variant of ...
void bgLoad(u8 bg, const BgAsset *asset, u8 palette_slot, u16 tiles_vram, u16 map_vram)
Load a full background bundle — typed-value variant of BG_LOAD.
SNES Background Layer Management.
static const BgAsset bg
Definition main.c:44
SNES DMA (Direct Memory Access).
unsigned short u16
16-bit unsigned integer (0 to 65535)
Definition types.h:53
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition types.h:47
A full background bundle: tileset + tilemap + map size.
Definition asset.h:126
u8 map_size
Tilemap layout. Use one of SC_32x32, SC_64x32, SC_32x64, SC_64x64.
Definition asset.h:137
u8 * tilemap_end
One past the end of the tilemap data.
Definition asset.h:132
GfxAsset gfx
Tileset (tiles + palette + color mode).
Definition asset.h:128
u8 * tilemap
Pointer to tilemap data (gfx4snes .map).
Definition asset.h:130
A tileset bundle: graphics + palette + color depth.
Definition asset.h:101
u8 * palette_end
One past the end of the palette data.
Definition asset.h:110
u16 color_mode
Color depth selector. Use one of: BG_4COLORS, BG_4COLORS0 (Mode 0), BG_16COLORS, BG_256COLORS....
Definition asset.h:117
u8 * palette
Pointer to BGR555 palette data.
Definition asset.h:108
u8 * tiles
Pointer to tile graphics data.
Definition asset.h:103
u8 * tiles_end
One past the end of tile graphics. Size is computed at load time as tiles_end - tiles.
Definition asset.h:106
OpenSNES Standard Types.