2015-08-19 21:06:58 +02:00
|
|
|
/* 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/>.
|
|
|
|
*/
|
|
|
|
|
2014-09-02 16:41:21 +02:00
|
|
|
#ifndef id6FB3FC97331449038D42AAAB4C01ABA1
|
|
|
|
#define id6FB3FC97331449038D42AAAB4C01ABA1
|
|
|
|
|
2015-01-06 16:38:52 +01:00
|
|
|
#include "doorkeeper/components/layer.hpp"
|
2015-05-25 01:37:20 +02:00
|
|
|
#include "doorkeeper/components/exception.hpp"
|
2014-09-02 16:41:21 +02:00
|
|
|
#include <vector>
|
2014-12-09 22:30:06 +01:00
|
|
|
#include <ciso646>
|
2014-12-09 23:53:09 +01:00
|
|
|
#include <memory>
|
2015-01-08 12:20:17 +01:00
|
|
|
#include <cstdint>
|
2014-09-02 16:41:21 +02:00
|
|
|
|
|
|
|
namespace dk {
|
2015-06-06 14:14:00 +02:00
|
|
|
template <uint32_t D>
|
2015-05-25 01:37:20 +02:00
|
|
|
class BaseMapSource;
|
2014-12-29 16:17:59 +01:00
|
|
|
|
2015-01-08 12:20:17 +01:00
|
|
|
template <uint32_t D>
|
2014-09-02 16:41:21 +02:00
|
|
|
class Tyler {
|
2014-12-09 23:53:09 +01:00
|
|
|
typedef std::unique_ptr<LayerBase<D>> LayerPtr;
|
|
|
|
typedef std::vector<LayerPtr> LayerList;
|
2014-09-02 16:41:21 +02:00
|
|
|
public:
|
2014-12-09 23:53:09 +01:00
|
|
|
typedef typename LayerBase<D>::coords coords;
|
2014-12-09 22:30:06 +01:00
|
|
|
|
|
|
|
Tyler ( void ) = delete;
|
2015-05-28 00:20:40 +02:00
|
|
|
Tyler ( Tyler&& ) = default;
|
2015-08-25 20:53:35 +02:00
|
|
|
Tyler ( const coords& parMapSize, const coords& parTileSize );
|
2014-12-09 23:53:09 +01:00
|
|
|
~Tyler ( void ) noexcept = default;
|
2014-12-09 22:30:06 +01:00
|
|
|
|
2015-08-16 22:29:34 +02:00
|
|
|
typename coords::scalar_type tiles_count ( void ) const;
|
2014-12-09 23:53:09 +01:00
|
|
|
const coords& map_size ( void ) const { return m_size; }
|
2015-08-26 00:00:43 +02:00
|
|
|
const coords& tile_size ( void ) const { return m_tilesize; }
|
2014-12-12 20:04:48 +01:00
|
|
|
|
2014-12-09 23:53:09 +01:00
|
|
|
template <typename T>
|
2015-06-07 03:57:18 +02:00
|
|
|
Layer<T, D>& push_layer ( BaseMapSource<D>* parTilemap, int parIndex );
|
2014-12-11 23:58:52 +01:00
|
|
|
template <typename T>
|
2015-06-07 03:57:18 +02:00
|
|
|
void push_layer_void ( BaseMapSource<D>* parTilemap, int parIndex );
|
2014-09-02 16:41:21 +02:00
|
|
|
|
2014-12-14 13:13:10 +01:00
|
|
|
void preload ( const coords& parFrom, const coords& parTo );
|
|
|
|
|
2014-09-02 16:41:21 +02:00
|
|
|
private:
|
2015-05-25 01:37:20 +02:00
|
|
|
coords m_size;
|
2014-12-11 23:58:52 +01:00
|
|
|
const coords m_tilesize;
|
2014-12-09 23:53:09 +01:00
|
|
|
LayerList m_layers;
|
2014-09-02 16:41:21 +02:00
|
|
|
};
|
|
|
|
} //namespace dk
|
|
|
|
|
2015-01-06 16:38:52 +01:00
|
|
|
#include "doorkeeper/implem/tyler.inl"
|
2014-12-09 22:30:06 +01:00
|
|
|
|
2014-09-02 16:41:21 +02:00
|
|
|
#endif
|