10 void LayerSet::init(
unsigned int width,
unsigned int height,
unsigned int bottomCount,
11 unsigned int ysortLayerCount,
unsigned int topLayerCount) {
49 BL_LOG_ERROR <<
"Accessing out of bounds layer: " << layer;
50 return bottom.front();
53 if (layer < bottom.size()) {
return bottom[layer]; }
54 layer -= bottom.size();
55 if (layer < ysort.size()) {
return ysort[layer]; }
56 return top[layer - ysort.size()];
Core classes and functionality for both the editor and game.
Generic map layer class. Can be used for any type of layer.
void create(unsigned int width, unsigned int height, const T &val=T())
Clears all stored data (if any) and creates the layer with the given size.
void init(unsigned int width, unsigned int height, unsigned int bottomLayerCount, unsigned int ysortLayerCount, unsigned int topLayercount)
Creates the given number of layers and sets the proper size for each layer, initializing each layer t...
CatchLayer & catchLayer()
Returns a reference to the catchable layer for this set.
std::vector< TileLayer > & bottomLayers()
Returns a reference to the bottom tiles in this set.
std::vector< TileLayer > & topLayers()
Returns a reference to the top tiles in this set.
CollisionLayer & collisionLayer()
Returns a reference to the collision layer for this set.
TileLayer & getLayer(unsigned int layer)
Returns a reference to the given tile layer. Helper to use absolute indices to access all layer zones...
std::vector< TileLayer > & ysortLayers()
Returns a reference to the sorted tiles in this set.
unsigned int layerCount() const
Returns the total number of layers contained.
static constexpr IdType Blank
Special id for blank tiles.