70 lines
2.2 KiB
C++
70 lines
2.2 KiB
C++
/* Copyright 2015, Michele Santullo
|
|
* This file is part of DoorKeeper.
|
|
*
|
|
* DoorKeeper is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* DoorKeeper is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with DoorKeeper. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef id6FB3FC97331449038D42AAAB4C01ABA1
|
|
#define id6FB3FC97331449038D42AAAB4C01ABA1
|
|
|
|
#include "doorkeeper/components/layer.hpp"
|
|
#include "doorkeeper/components/exception.hpp"
|
|
#include <vector>
|
|
#include <ciso646>
|
|
#include <memory>
|
|
#include <cstdint>
|
|
#include <boost/iterator/indirect_iterator.hpp>
|
|
#include <functional>
|
|
|
|
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;
|
|
typedef boost::indirect_iterator<typename LayerList::iterator> iterator;
|
|
typedef boost::indirect_iterator<typename LayerList::const_iterator> const_iterator;
|
|
typedef std::function<void(const LayerBase<D>&, bool) noexcept> layer_callback;
|
|
|
|
Tyler ( void );
|
|
Tyler ( Tyler&& ) = default;
|
|
~Tyler ( void ) noexcept = default;
|
|
|
|
template <typename T>
|
|
Layer<T, D>& push_layer ( BaseMapSource<D>* parTilemap, int parIndex );
|
|
template <typename T>
|
|
void push_layer_void ( BaseMapSource<D>* parTilemap, int parIndex );
|
|
|
|
iterator begin ( void );
|
|
const_iterator begin ( void ) const;
|
|
iterator end ( void );
|
|
const_iterator end ( void ) const;
|
|
|
|
void preload ( const coords& parFrom, const coords& parTo );
|
|
void register_for_layeradd ( layer_callback parCallback );
|
|
void unregister_for_layeradd ( layer_callback parCallback );
|
|
|
|
private:
|
|
LayerList m_layers;
|
|
std::vector<layer_callback> m_layer_add_callbacks;
|
|
};
|
|
} //namespace dk
|
|
|
|
#include "doorkeeper/implem/tyler.inl"
|
|
|
|
#endif
|