1 #ifndef CORE_MAPS_LAYERSET_HPP
2 #define CORE_MAPS_LAYERSET_HPP
69 void init(
unsigned int width,
unsigned int height,
unsigned int bottomLayerCount,
70 unsigned int ysortLayerCount,
unsigned int topLayercount);
140 const std::vector<TileLayer>&
topLayers()
const;
160 std::vector<TileLayer> bottom;
161 std::vector<TileLayer> ysort;
162 std::vector<TileLayer> top;
164 friend struct bl::serial::SerializableObject<
LayerSet>;
175 struct SerializableObject<
core::map::LayerSet> :
public SerializableObjectBase {
176 SerializableField<1, core::map::LayerSet, core::map::CollisionLayer>
collisions;
177 SerializableField<2, core::map::LayerSet, core::map::CatchLayer>
catches;
178 SerializableField<3, core::map::LayerSet, std::vector<core::map::TileLayer>>
bottom;
179 SerializableField<4, core::map::LayerSet, std::vector<core::map::TileLayer>>
ysort;
180 SerializableField<5, core::map::LayerSet, std::vector<core::map::TileLayer>>
top;
183 : SerializableObjectBase(
"LayerSet")
184 , collisions(
"cols", *this, &
core::map::LayerSet::collisions, SerializableFieldBase::Required{})
185 , catches(
"catches", *this, &
core::map::LayerSet::catches, SerializableFieldBase::Required{})
186 , bottom(
"bottom", *this, &
core::map::LayerSet::bottom, SerializableFieldBase::Required{})
187 , ysort(
"ysort", *this, &
core::map::LayerSet::ysort, SerializableFieldBase::Required{})
188 , top(
"top", *this, &
core::map::LayerSet::top, SerializableFieldBase::Required{}) {}
Core classes and functionality for both the editor and game.
Encapsulates a set of layers for a given map height. Maps have one LayerSet per height level,...
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.
LayerSet()=default
Builds a new empty layer set.
unsigned int layerCount() const
Returns the total number of layers contained.
SerializableField< 5, core::map::LayerSet, std::vector< core::map::TileLayer > > top
SerializableField< 1, core::map::LayerSet, core::map::CollisionLayer > collisions
SerializableField< 3, core::map::LayerSet, std::vector< core::map::TileLayer > > bottom
SerializableField< 2, core::map::LayerSet, core::map::CatchLayer > catches
SerializableField< 4, core::map::LayerSet, std::vector< core::map::TileLayer > > ysort