DoorKeeper/include/doorkeeper/components/tyler.hpp
King_DuckZ fd8a1cbabc Add a hash mechanism to BaseMapSource.
This is needed to recognize what type of tiles a layer contains.
Client code has to fill in a map of hash => add_layer<T>() pointers.
As a layer is loaded, the correct add_layer<T>() is called based
on the hash saved with the layer itself.
2015-06-07 03:57:18 +02:00

49 lines
1.3 KiB
C++

#ifndef id6FB3FC97331449038D42AAAB4C01ABA1
#define id6FB3FC97331449038D42AAAB4C01ABA1
#include "doorkeeper/components/layer.hpp"
#include "doorkeeper/components/exception.hpp"
#include <vector>
#include <cassert>
#include <ciso646>
#include <memory>
#include <cstdint>
namespace dk {
template <uint32_t D>
class BaseMapSource;
template <uint32_t D>
class Tyler {
typedef std::unique_ptr<LayerBase<D>> LayerPtr;
typedef std::vector<LayerPtr> LayerList;
public:
typedef typename LayerBase<D>::coords coords;
Tyler ( void ) = delete;
Tyler ( Tyler&& ) = default;
explicit Tyler ( const coords& parTileSize );
~Tyler ( void ) noexcept = default;
typename coords::value_type tiles_count ( void ) const;
const coords& map_size ( void ) const { return m_size; }
template <typename T>
Layer<T, D>& push_layer ( BaseMapSource<D>* parTilemap, int parIndex );
template <typename T>
Layer<T, D>& push_layer ( BaseMapSource<D>* parTilemap, const coords& parSubdiv, int parIndex );
template <typename T>
void push_layer_void ( BaseMapSource<D>* parTilemap, int parIndex );
void preload ( const coords& parFrom, const coords& parTo );
private:
coords m_size;
const coords m_tilesize;
LayerList m_layers;
};
} //namespace dk
#include "doorkeeper/implem/tyler.inl"
#endif