Overhaul how building and ownership layers are handled at init
This commit is contained in:
@@ -9,6 +9,16 @@
|
||||
|
||||
BzTileMap BZ_TILEMAP_INVALID = {.isValid = false};
|
||||
|
||||
void bzTileLayerSkipRender(BzTileLayer *layer) {
|
||||
|
||||
}
|
||||
void bzTileObjectGroupSkipRender(BzTileObjectGroup *objectGroup) {
|
||||
|
||||
}
|
||||
|
||||
BzTileLayerRenderFunc BZ_TILE_LAYER_SKIP_RENDER = bzTileLayerSkipRender;
|
||||
BzTileObjectGroupRenderFunc BZ_TILE_OBJECTS_SKIP_RENDER = bzTileObjectGroupSkipRender;
|
||||
|
||||
bool bzTileLayerClear(BzTileLayer *layer, BzTile *data, i32 dataCount) {
|
||||
return true;
|
||||
}
|
||||
@@ -22,6 +32,13 @@ BzTileObjectsFunc BZ_TILE_OBJECTS_CLEAR = bzTileObjectsClear;
|
||||
BzTile bzTileLayerGetTile(BzTileLayer *layer, i32 x, i32 y) {
|
||||
return layer->data[layer->width * y + x];
|
||||
}
|
||||
void bzTileLayerSetTile(BzTileLayer *layer, BzTile tile, i32 x, i32 y, i32 w, i32 h) {
|
||||
for (i32 yIdx = y; yIdx < y + h; yIdx++) {
|
||||
for (i32 xIdx = x; xIdx < x + w; xIdx++) {
|
||||
layer->data[yIdx * layer->width + xIdx] = tile;
|
||||
}
|
||||
}
|
||||
}
|
||||
BzTileset *bzTileLayerGetTileset(BzTileMap *map, BzTileLayer *layer) {
|
||||
i32 idx = layer->tilesetIdx;
|
||||
if (idx < 0 || idx >= map->tilesetCount)
|
||||
|
||||
@@ -15,6 +15,9 @@ typedef struct BzTileObjectGroup BzTileObjectGroup;
|
||||
typedef void (*BzTileLayerRenderFunc)(BzTileLayer *layer);
|
||||
typedef void (*BzTileObjectGroupRenderFunc)(BzTileObjectGroup *objectGroup);
|
||||
|
||||
extern BzTileLayerRenderFunc BZ_TILE_LAYER_SKIP_RENDER;
|
||||
extern BzTileObjectGroupRenderFunc BZ_TILE_OBJECTS_SKIP_RENDER;
|
||||
|
||||
typedef struct BzTileLayerDesc {
|
||||
const char *name; // Matches map layer names
|
||||
BzTileLayerRenderFunc renderer;
|
||||
@@ -105,6 +108,7 @@ extern BzTileLayerFunc BZ_TILE_LAYER_CLEAR;
|
||||
extern BzTileObjectsFunc BZ_TILE_OBJECTS_CLEAR;
|
||||
|
||||
BzTile bzTileLayerGetTile(BzTileLayer *layer, i32 x, i32 y);
|
||||
void bzTileLayerSetTile(BzTileLayer *layer, BzTile tile, i32 x, i32 y, i32 w, i32 h);
|
||||
BzTileset *bzTileLayerGetTileset(BzTileMap *map, BzTileLayer *layer);
|
||||
|
||||
BzTileMap bzTileMapCreate(const BzTileMapDesc *desc);
|
||||
|
||||
Reference in New Issue
Block a user