65 lines
1.1 KiB
C
65 lines
1.1 KiB
C
#ifndef BREEZE_MAP_H
|
|
#define BREEZE_MAP_H
|
|
|
|
#include "tileset.h"
|
|
|
|
#define BZ_MAX_MAP_LAYERS 16
|
|
#define BZ_MAX_MAP_TILESETS 8
|
|
|
|
|
|
typedef struct BzTileLayer {
|
|
i32 id;
|
|
|
|
int16_t *data;
|
|
i32 dataCount;
|
|
i16 minData;
|
|
i16 maxData;
|
|
|
|
i32 width;
|
|
i32 height;
|
|
|
|
f32 offsetX;
|
|
f32 offsetY;
|
|
f32 opacity;
|
|
|
|
i32 tilesetIdx;
|
|
} BzTileLayer;
|
|
|
|
|
|
typedef struct BzTileMapDesc {
|
|
const char *path;
|
|
BzTileset tilesets[BZ_MAX_MAP_TILESETS];
|
|
i32 tilesetCount;
|
|
} BzTileMapDesc;
|
|
|
|
typedef struct BzTileMap {
|
|
Color backgroundColor;
|
|
|
|
i32 width;
|
|
i32 height;
|
|
i32 tileWidth;
|
|
i32 tileHeight;
|
|
|
|
BzTileLayer layers[BZ_MAX_MAP_LAYERS];
|
|
i32 layerCount;
|
|
|
|
BzTileset tilesets[BZ_MAX_MAP_TILESETS];
|
|
i32 tilesetCount;
|
|
|
|
bool isValid;
|
|
} BzTileMap;
|
|
|
|
extern BzTileMap BZ_TILEMAP_INVALID;
|
|
|
|
int16_t bzTileLayerGetTile(BzTileLayer *layer, i32 x, i32 y);
|
|
|
|
BzTileMap bzTileMapCreate(const BzTileMapDesc *desc);
|
|
void bzTileMapDestroy(BzTileMap *tilemap);
|
|
|
|
void bzTileMapDraw(BzTileMap *map);
|
|
bool bzTileMapCanPlace(BzTileMap *map, i32 tileX, i32 tileY, i32 sizeX, i32 sizeY);
|
|
|
|
|
|
|
|
#endif //BREEZE_MAP_H
|