summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-09-01 14:50:07 -0700
committer3gg <3gg@shellblade.net>2025-09-01 14:50:27 -0700
commitdb3fd5aac9c66e64aa56fabc1a865fb64a65fc1c (patch)
tree36f84f93e37b517dfd6bab7fc322695e96fe0181 /include
parent6ca52695de52c432feafbe3d8c8e25cbd8d8ec34 (diff)
Add support for single-image tile sets (not yet tested).
Diffstat (limited to 'include')
-rw-r--r--include/isogfx/asset.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/include/isogfx/asset.h b/include/isogfx/asset.h
index 9aeb55d..6050500 100644
--- a/include/isogfx/asset.h
+++ b/include/isogfx/asset.h
@@ -25,8 +25,15 @@ typedef struct Ts_Tile {
25 uint32_t pixels; // Byte offset into the Ts_TileSet's 'pixels'. 25 uint32_t pixels; // Byte offset into the Ts_TileSet's 'pixels'.
26} Ts_Tile; 26} Ts_Tile;
27 27
28// Tileset.
29//
30// Tile dimensions may be larger than the baseline tile dimensions of the
31// tileset if the tileset contains supertiles. Regardless, tile dimensions are
32// always a multiple of baseline dimensions along each axis.
28typedef struct Ts_TileSet { 33typedef struct Ts_TileSet {
29 uint16_t num_tiles; 34 uint16_t num_tiles;
35 uint16_t tile_width; // Baseline tile width.
36 uint16_t tile_height; // Baseline tile height.
30 uint16_t _pad; 37 uint16_t _pad;
31 Ts_Tile tiles[1]; // Count: num_tiles. 38 Ts_Tile tiles[1]; // Count: num_tiles.
32 Pixel pixels[]; // Count: sum_i(tile[i].width * tile[i].height). 39 Pixel pixels[]; // Count: sum_i(tile[i].width * tile[i].height).
@@ -64,8 +71,8 @@ typedef struct Tm_Map {
64/// 71///
65/// Pixels are 8-bit indices into the sprite sheet's colour palette. 72/// Pixels are 8-bit indices into the sprite sheet's colour palette.
66typedef struct Ss_Row { 73typedef struct Ss_Row {
67 uint16_t num_cols; /// Number of columns in this row. 74 uint16_t num_cols; // Number of columns in this row.
68 uint8_t pixels[1]; /// Count: num_cols * sprite_width * sprite_height. 75 uint8_t pixels[1]; // Count: num_cols * sprite_width * sprite_height.
69} Ss_Row; 76} Ss_Row;
70 77
71typedef struct Ss_Palette { 78typedef struct Ss_Palette {
@@ -77,11 +84,11 @@ typedef struct Ss_Palette {
77/// 84///
78/// Sprite width and height are assumed constant throughout the sprite sheet. 85/// Sprite width and height are assumed constant throughout the sprite sheet.
79typedef struct Ss_SpriteSheet { 86typedef struct Ss_SpriteSheet {
80 uint16_t sprite_width; /// Sprite width in pixels. 87 uint16_t sprite_width; // Sprite width in pixels.
81 uint16_t sprite_height; /// Sprite height in pixels. 88 uint16_t sprite_height; // Sprite height in pixels.
82 uint16_t num_rows; 89 uint16_t num_rows;
83 Ss_Palette palette; /// Variable size. 90 Ss_Palette palette; // Variable size.
84 Ss_Row rows[1]; /// Count: num_rows. Variable offset. 91 Ss_Row rows[1]; // Count: num_rows. Variable offset.
85} Ss_SpriteSheet; 92} Ss_SpriteSheet;
86 93
87// ----------------------------------------------------------------------------- 94// -----------------------------------------------------------------------------