Give the tilemap types struct tags so they can be forward-declared
`typedef struct { ... } akgl_Tilemap;` declares no struct tag, so
`struct akgl_Tilemap` does not exist and no header can forward-declare it. That
is fine while every consumer includes tilemap.h, and it is a blocker the moment
a leaf header needs to name the type without pulling it in -- which the coming
collision header does, since tilemap.h reaches physics.h and a cycle forms
otherwise.
All four types in the file get a tag rather than just akgl_Tilemap: they are
siblings declared the same way in the same header, and tagging one of four is
the kind of inconsistency that makes the next reader wonder what is special
about it.
Layout-identical and no behaviour: a tag names a type, it does not change one.
Full suite, reindent and doxygen unchanged.
sprite.h and iterator.h declare their types the same way and are deliberately
left alone; nothing needs to forward-declare them yet.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
#define AKGL_TILEMAP_LAYER_TYPE_IMAGE 3
|
||||
|
||||
/** @brief One object placed in a Tiled object layer. */
|
||||
typedef struct {
|
||||
typedef struct akgl_TilemapObject {
|
||||
float32_t x; /**< Position in map pixels, from the Tiled object. Copied onto the actor it spawns. */
|
||||
float32_t y; /**< Position in map pixels. */
|
||||
int gid; /**< Global tile id, for a tile object. Not read by the loader. */
|
||||
@@ -85,7 +85,7 @@ typedef struct {
|
||||
} akgl_TilemapObject;
|
||||
|
||||
/** @brief One layer of a tilemap: a tile grid, an image, or a group of objects. */
|
||||
typedef struct {
|
||||
typedef struct akgl_TilemapLayer {
|
||||
short type; /**< Which of the `AKGL_TILEMAP_LAYER_TYPE_*` kinds this is; decides which of the members below mean anything. */
|
||||
float32_t opacity; /**< 0.0 to 1.0, from Tiled. Recorded but not yet applied at draw time. */
|
||||
bool visible; /**< From Tiled. Recorded but not yet consulted at draw time. */
|
||||
@@ -100,7 +100,7 @@ typedef struct {
|
||||
} akgl_TilemapLayer;
|
||||
|
||||
/** @brief One tileset: an image cut into a grid, plus the lookup table that finds a tile in it. */
|
||||
typedef struct {
|
||||
typedef struct akgl_Tileset {
|
||||
int columns; /**< Tiles per row in the image. What turns a linear tile id into a row and column. */
|
||||
int firstgid; /**< Global id of this tileset's first tile. Subtracting it from a map cell gives the local tile id. */
|
||||
char imagefilename[AKGL_TILEMAP_MAX_TILESET_FILENAME_SIZE]; /**< Resolved absolute path to the image, from the map file's directory. */
|
||||
@@ -131,7 +131,7 @@ typedef struct {
|
||||
} akgl_Tileset;
|
||||
|
||||
/** @brief Represents a complete tilemap and its optional physics backend. */
|
||||
typedef struct {
|
||||
typedef struct akgl_Tilemap {
|
||||
int tilewidth; /**< Width of one map cell in pixels. Tiles from a tileset with a different tile size are not rescaled. */
|
||||
int tileheight; /**< Height of one map cell in pixels. */
|
||||
int width; /**< Map width in tiles. */
|
||||
|
||||
Reference in New Issue
Block a user