Tyler, Viewport and Layer take PixConv as a parameter instead of D.
This commit is contained in:
parent
f073bb5793
commit
25fead8ab6
18 changed files with 200 additions and 220 deletions
|
@ -15,7 +15,7 @@
|
|||
* along with DoorKeeper. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "doorkeeper/doorkeeper2d.hpp"
|
||||
#include "doorkeeper/doorkeeper.hpp"
|
||||
#include "doorkeeper/helpers/maploader.hpp"
|
||||
#include "doorkeeper/helpers/asciimapsource.hpp"
|
||||
#include "doorkeeper/helpers/typename_native.hpp"
|
||||
|
@ -23,17 +23,18 @@
|
|||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
using dk::Tyler2d;
|
||||
using dk::coords2;
|
||||
using dk::Viewport2d;
|
||||
using dk::Layer2d;
|
||||
typedef dkh::MapLoaderPool2d<std::function<dk::BaseMapSource2d*(const std::string&)>> IntPoolType;
|
||||
using PixelConvType = dk::PixelConvSquare<2>;
|
||||
using Tyler2d = dk::Tyler<PixelConvType>;
|
||||
using coords2 = Tyler2d::coords;
|
||||
//using Viewport2d = dk::Viewport<PixelConvType>;
|
||||
//using Layer2d = dk::Layer<int, PixelConvType>;
|
||||
typedef dkh::MapLoaderPool<PixelConvType, std::function<dk::BaseMapSource<2>*(const std::string&)>> IntPoolType;
|
||||
|
||||
std::cout << "Welcome to " GAME_NAME " v" << GAME_VER_MAJOR << '.' << GAME_VER_MINOR << '.' << GAME_VER_PATCH << '\n';
|
||||
|
||||
IntPoolType pool;
|
||||
pool.opener = [](const std::string& parName) { std::cout << "Opening " << parName << std::endl; return new dkh::AsciiMapSource(parName, coords2(10, 8), dk::MapType_IsometricStaggered, coords2(64, 64)); };
|
||||
dkh::PushLayerMapType<2> pushers;
|
||||
dkh::PushLayerMapType<PixelConvType> pushers;
|
||||
pushers.insert(std::make_pair(dk::type_name_hash<int>(), &Tyler2d::push_layer_void<int>));
|
||||
Tyler2d tiler(dkh::call_map_load(pool, std::string("test_level.dk"), pushers));
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#endif
|
||||
|
||||
namespace dk {
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
class Viewport;
|
||||
|
||||
template <uint32_t D>
|
||||
|
@ -58,18 +58,22 @@ namespace dk {
|
|||
coords m_haveTo;
|
||||
};
|
||||
|
||||
template <typename T, uint32_t D>
|
||||
class Layer : public LayerBase<D> {
|
||||
friend class Viewport<D>;
|
||||
template <typename T, typename PixConv>
|
||||
class Layer : public LayerBase<PixConv::dimensions> {
|
||||
friend class Viewport<PixConv>;
|
||||
|
||||
public:
|
||||
typedef typename LayerBase<D>::coords coords;
|
||||
typedef TileIterator<T, D> iterator;
|
||||
typedef TileIterator<const T, D> const_iterator;
|
||||
enum {
|
||||
dimensions = PixConv::dimensions
|
||||
};
|
||||
|
||||
typedef typename LayerBase<dimensions>::coords coords;
|
||||
typedef TileIterator<T, dimensions> iterator;
|
||||
typedef TileIterator<const T, dimensions> const_iterator;
|
||||
|
||||
Layer ( const Layer& ) = delete;
|
||||
Layer ( Layer&& ) = default;
|
||||
Layer ( const coords& parTileSize, const coords& parMasterTileSize, BaseMapSource<D>* parTilemap );
|
||||
Layer ( const coords& parTileSize, const coords& parMasterTileSize, BaseMapSource<dimensions>* parTilemap );
|
||||
virtual ~Layer ( void ) noexcept = default;
|
||||
|
||||
Layer& operator= ( const Layer& ) = delete;
|
||||
|
@ -81,7 +85,7 @@ namespace dk {
|
|||
virtual void onPreload ( const coords& parFrom, const coords& parTo );
|
||||
|
||||
std::vector<T> m_tiles;
|
||||
BaseMapSource<D>* m_tilemap;
|
||||
BaseMapSource<dimensions>* m_tilemap;
|
||||
};
|
||||
} //namespace dk
|
||||
|
||||
|
|
|
@ -27,6 +27,10 @@ namespace dk {
|
|||
template <uint32_t D>
|
||||
class PixelConv {
|
||||
public:
|
||||
enum {
|
||||
dimensions = D
|
||||
};
|
||||
|
||||
typedef Vector<D> coords;
|
||||
|
||||
PixelConv ( MapTypes parType, const coords& parTileSize );
|
||||
|
@ -55,20 +59,19 @@ namespace dk {
|
|||
virtual coords pick_tile ( const coords& parPixelPoint ) const;
|
||||
};
|
||||
|
||||
template <CoordinateScalarType DivX, CoordinateScalarType DivY>
|
||||
class PixelConvDiamond : public PixelConv<2> {
|
||||
public:
|
||||
using base_class = PixelConv<2>;
|
||||
using base_class::coords;
|
||||
|
||||
PixelConvDiamond ( const coords& parTileSize, bool parStaggered, bool parFirstReentrant );
|
||||
PixelConvDiamond ( const coords& parTileSize, bool parStaggered, bool parFirstReentrant, const coords& parRatio );
|
||||
virtual ~PixelConvDiamond ( void ) noexcept = default;
|
||||
|
||||
virtual coords to_pixel ( const coords& parFrom ) const;
|
||||
virtual coords pick_tile ( const coords& parPixelPoint ) const;
|
||||
|
||||
protected:
|
||||
const coords m_ratio;
|
||||
const CoordinateScalarType m_first_reentr;
|
||||
const bool m_staggered;
|
||||
};
|
||||
|
|
|
@ -29,12 +29,16 @@ namespace dk {
|
|||
template <uint32_t D>
|
||||
class BaseMapSource;
|
||||
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
class Tyler {
|
||||
typedef std::unique_ptr<LayerBase<D>> LayerPtr;
|
||||
typedef std::unique_ptr<LayerBase<PixConv::dimensions>> LayerPtr;
|
||||
typedef std::vector<LayerPtr> LayerList;
|
||||
public:
|
||||
typedef typename LayerBase<D>::coords coords;
|
||||
enum {
|
||||
dimensions = PixConv::dimensions
|
||||
};
|
||||
|
||||
typedef typename LayerBase<dimensions>::coords coords;
|
||||
|
||||
Tyler ( void ) = delete;
|
||||
Tyler ( Tyler&& ) = default;
|
||||
|
@ -45,11 +49,11 @@ namespace dk {
|
|||
const coords& map_size ( void ) const { return m_size; }
|
||||
|
||||
template <typename T>
|
||||
Layer<T, D>& push_layer ( BaseMapSource<D>* parTilemap, int parIndex );
|
||||
Layer<T, PixConv>& push_layer ( BaseMapSource<dimensions>* parTilemap, int parIndex );
|
||||
template <typename T>
|
||||
Layer<T, D>& push_layer ( BaseMapSource<D>* parTilemap, const coords& parSubdiv, int parIndex );
|
||||
Layer<T, PixConv>& push_layer ( BaseMapSource<dimensions>* parTilemap, const coords& parSubdiv, int parIndex );
|
||||
template <typename T>
|
||||
void push_layer_void ( BaseMapSource<D>* parTilemap, int parIndex );
|
||||
void push_layer_void ( BaseMapSource<dimensions>* parTilemap, int parIndex );
|
||||
|
||||
void preload ( const coords& parFrom, const coords& parTo );
|
||||
|
||||
|
|
|
@ -24,20 +24,24 @@
|
|||
#include <cstdint>
|
||||
|
||||
namespace dk {
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
class Tyler;
|
||||
|
||||
template <typename T, uint32_t D>
|
||||
template <typename T, typename PixConv>
|
||||
class Layer;
|
||||
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
class Viewport {
|
||||
public:
|
||||
typedef Vector<D> coords;
|
||||
enum {
|
||||
dimensions = PixConv::dimensions
|
||||
};
|
||||
|
||||
typedef Vector<dimensions> coords;
|
||||
|
||||
Viewport ( const Viewport& parOther ) = default;
|
||||
explicit Viewport ( Tyler<D>& parTyler );
|
||||
Viewport ( Tyler<D>& parTyler, const coords& parSize, const coords& parPos );
|
||||
explicit Viewport ( Tyler<PixConv>& parTyler );
|
||||
Viewport ( Tyler<PixConv>& parTyler, const coords& parSize, const coords& parPos );
|
||||
~Viewport ( void ) noexcept = default;
|
||||
|
||||
Viewport& operator= ( const Viewport& ) = default;
|
||||
|
@ -48,22 +52,22 @@ namespace dk {
|
|||
const coords& count ( void ) const { return m_size; }
|
||||
|
||||
template <typename T>
|
||||
typename Layer<T, D>::iterator begin ( Layer<T, D>& parLayer ) const;
|
||||
typename Layer<T, PixConv>::iterator begin ( Layer<T, PixConv>& parLayer ) const;
|
||||
template <typename T>
|
||||
typename Layer<T, D>::iterator end ( Layer<T, D>& parLayer ) const;
|
||||
typename Layer<T, PixConv>::iterator end ( Layer<T, PixConv>& parLayer ) const;
|
||||
template <typename T> inline
|
||||
typename Layer<T, D>::const_iterator begin ( const Layer<T, D>& parLayer ) const a_always_inline;
|
||||
typename Layer<T, PixConv>::const_iterator begin ( const Layer<T, PixConv>& parLayer ) const a_always_inline;
|
||||
template <typename T> inline
|
||||
typename Layer<T, D>::const_iterator end ( const Layer<T, D>& parLayer ) const a_always_inline;
|
||||
typename Layer<T, PixConv>::const_iterator end ( const Layer<T, PixConv>& parLayer ) const a_always_inline;
|
||||
template <typename T>
|
||||
typename Layer<T, D>::const_iterator cbegin ( const Layer<T, D>& parLayer ) const;
|
||||
typename Layer<T, PixConv>::const_iterator cbegin ( const Layer<T, PixConv>& parLayer ) const;
|
||||
template <typename T>
|
||||
typename Layer<T, D>::const_iterator cend ( const Layer<T, D>& parLayer ) const;
|
||||
typename Layer<T, PixConv>::const_iterator cend ( const Layer<T, PixConv>& parLayer ) const;
|
||||
|
||||
private:
|
||||
coords m_size;
|
||||
coords m_position;
|
||||
Tyler<D>& m_tyler;
|
||||
Tyler<PixConv>& m_tyler;
|
||||
};
|
||||
} //namespace dk
|
||||
|
||||
|
|
|
@ -22,5 +22,6 @@
|
|||
#include "components/tyler.hpp"
|
||||
#include "components/viewport.hpp"
|
||||
#include "components/layer.hpp"
|
||||
#include "components/pixelconv.hpp"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/* 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 id6327FA76CFB44F65A459C69096EC65D5
|
||||
#define id6327FA76CFB44F65A459C69096EC65D5
|
||||
|
||||
#include "doorkeeper.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace dk {
|
||||
typedef Tyler<2>::coords coords2;
|
||||
typedef Tyler<2> Tyler2d;
|
||||
template <typename T> using Layer2d = Layer<T, 2>;
|
||||
typedef Viewport<2> Viewport2d;
|
||||
typedef BaseMapSource<2> BaseMapSource2d;
|
||||
} //namespace dk
|
||||
|
||||
namespace dkh {
|
||||
template <uint32_t D, typename C>
|
||||
struct MapLoaderPool;
|
||||
|
||||
template <typename C>
|
||||
using MapLoaderPool2d = MapLoaderPool<2, C>;
|
||||
} //namespace dkh
|
||||
|
||||
#endif
|
|
@ -22,7 +22,6 @@
|
|||
#include "doorkeeper/components/basemapsource.hpp"
|
||||
#include "doorkeeper/helpers/typename.hpp"
|
||||
#include "doorkeeper/components/exception.hpp"
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
@ -31,41 +30,42 @@
|
|||
#include <ciso646>
|
||||
|
||||
namespace dkh {
|
||||
template <uint32_t D>
|
||||
using PushLayerMapType = std::map<dk::HashType, void(dk::Tyler<D>::*)(dk::BaseMapSource<D>*,int)>;
|
||||
template <typename PixConv>
|
||||
using PushLayerMapType = std::map<dk::HashType, void(dk::Tyler<PixConv>::*)(dk::BaseMapSource<PixConv::dimensions>*,int)>;
|
||||
|
||||
template <uint32_t D, typename C>
|
||||
template <typename PixConv, typename C>
|
||||
struct MapLoaderPool {
|
||||
typedef std::unique_ptr<dk::BaseMapSource<D>> BaseMapSourceUPtr;
|
||||
enum { dimensions = PixConv::dimensions };
|
||||
typedef std::unique_ptr<dk::BaseMapSource<dimensions>> BaseMapSourceUPtr;
|
||||
typedef std::map<std::string, BaseMapSourceUPtr> PoolMapType;
|
||||
typedef PixConv PixelConvType;
|
||||
|
||||
enum { dimensions = D };
|
||||
typedef C opener_type;
|
||||
|
||||
PoolMapType pool;
|
||||
C opener;
|
||||
|
||||
dk::BaseMapSource<D>* operator() ( const std::string& parName );
|
||||
dk::BaseMapSource<dimensions>* operator() ( const std::string& parName );
|
||||
};
|
||||
|
||||
class UnknownLayerTemplateException : public dk::DoorKeeperException {
|
||||
};
|
||||
|
||||
template <typename M>
|
||||
dk::Tyler<M::dimensions> call_map_load ( M& parFileOpener, const std::string& parOpen, const PushLayerMapType<M::dimensions>& parPusher );
|
||||
dk::Tyler<typename M::PixelConvType> call_map_load ( M& parFileOpener, const std::string& parOpen, const PushLayerMapType<typename M::PixelConvType>& parPusher );
|
||||
|
||||
template <typename M>
|
||||
dk::Tyler<M::dimensions> call_map_load ( dk::Tyler<M::dimensions>& parTyler, M& parFileOpener, const std::string& parOpen, const PushLayerMapType<M::dimensions>& parPusher );
|
||||
dk::Tyler<typename M::PixelConvType> call_map_load ( dk::Tyler<typename M::PixelConvType>& parTyler, M& parFileOpener, const std::string& parOpen, const PushLayerMapType<typename M::PixelConvType>& parPusher );
|
||||
|
||||
template <uint32_t D, typename C>
|
||||
dk::Tyler<D> map_load ( C& parFileOpener, const std::string& parOpen, const PushLayerMapType<D>& parPusher );
|
||||
template <typename PixConv, typename C>
|
||||
dk::Tyler<PixConv> map_load ( C& parFileOpener, const std::string& parOpen, const PushLayerMapType<PixConv>& parPusher );
|
||||
|
||||
template <uint32_t D, typename C>
|
||||
dk::Tyler<D>& map_load ( dk::Tyler<D>& parTyler, C& parFileOpener, const std::string& parOpen, const PushLayerMapType<D>& parPusher );
|
||||
template <typename PixConv, typename C>
|
||||
dk::Tyler<PixConv>& map_load ( dk::Tyler<PixConv>& parTyler, C& parFileOpener, const std::string& parOpen, const PushLayerMapType<PixConv>& parPusher );
|
||||
|
||||
namespace implem {
|
||||
template <uint32_t D>
|
||||
void call_push_layer ( dk::Tyler<D>& parTyler, const PushLayerMapType<D>& parPusher, dk::BaseMapSource<D>* parReader, int parIndex );
|
||||
template <typename PixConv>
|
||||
void call_push_layer ( dk::Tyler<PixConv>& parTyler, const PushLayerMapType<PixConv>& parPusher, dk::BaseMapSource<PixConv::dimensions>* parReader, int parIndex );
|
||||
} //namespace implem
|
||||
} //namespace dkh
|
||||
|
||||
|
|
|
@ -42,9 +42,9 @@ namespace dk {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <typename T, uint32_t D>
|
||||
Layer<T, D>::Layer (const coords& parTileSize, const coords& parMasterTileSize, BaseMapSource<D>* parTilemap) :
|
||||
LayerBase<D>(parTilemap->mapSize(), parTileSize, parMasterTileSize),
|
||||
template <typename T, typename PixConv>
|
||||
Layer<T, PixConv>::Layer (const coords& parTileSize, const coords& parMasterTileSize, BaseMapSource<dimensions>* parTilemap) :
|
||||
LayerBase<dimensions>(parTilemap->mapSize(), parTileSize, parMasterTileSize),
|
||||
m_tilemap(parTilemap)
|
||||
{
|
||||
DK_ASSERT(m_tilemap);
|
||||
|
@ -52,22 +52,22 @@ namespace dk {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <typename T, uint32_t D>
|
||||
typename Layer<T, D>::iterator Layer<T, D>::begin() {
|
||||
template <typename T, typename PixConv>
|
||||
typename Layer<T, PixConv>::iterator Layer<T, PixConv>::begin() {
|
||||
return iterator(&m_tiles, m_tilemap->pixel_conv(), coords(0), this->m_count);
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <typename T, uint32_t D>
|
||||
typename Layer<T, D>::iterator Layer<T, D>::end() {
|
||||
return iterator(&m_tiles, m_tilemap->pixel_conv(), make_past_end_coords<D>(this->m_count - 1), make_past_end_coords<D>(this->m_count - 1));
|
||||
template <typename T, typename PixConv>
|
||||
typename Layer<T, PixConv>::iterator Layer<T, PixConv>::end() {
|
||||
return iterator(&m_tiles, m_tilemap->pixel_conv(), make_past_end_coords<dimensions>(this->m_count - 1), make_past_end_coords<dimensions>(this->m_count - 1));
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <typename T, uint32_t D>
|
||||
void Layer<T, D>::onPreload (const coords& parFrom, const coords& parTo) {
|
||||
template <typename T, typename PixConv>
|
||||
void Layer<T, PixConv>::onPreload (const coords& parFrom, const coords& parTo) {
|
||||
m_tiles.clear();
|
||||
m_tilemap->fetch(m_tiles, parFrom, parTo);
|
||||
#if !defined(NDEBUG)
|
||||
|
|
|
@ -16,29 +16,31 @@
|
|||
*/
|
||||
|
||||
namespace dkh {
|
||||
template <uint32_t D, typename C>
|
||||
dk::Tyler<D> map_load (C& parFileOpener, const std::string& parOpen, const PushLayerMapType<D>& parPusher) {
|
||||
dk::BaseMapSource<D>* reader = parFileOpener(parOpen);
|
||||
dk::Tyler<D> tyler(reader->tileSize());
|
||||
template <typename PixConv, typename C>
|
||||
dk::Tyler<PixConv> map_load (C& parFileOpener, const std::string& parOpen, const PushLayerMapType<PixConv>& parPusher) {
|
||||
constexpr uint32_t dimensions = PixConv::dimensions;
|
||||
dk::BaseMapSource<dimensions>* reader = parFileOpener(parOpen);
|
||||
dk::Tyler<PixConv> tyler(reader->tileSize());
|
||||
for (int z = 0; z < reader->layersCount(); ++z) {
|
||||
implem::call_push_layer<D>(tyler, parPusher, reader, z);
|
||||
implem::call_push_layer(tyler, parPusher, reader, z);
|
||||
}
|
||||
std::vector<std::string> submaps;
|
||||
reader->chainedMaps(submaps);
|
||||
for (const auto& name : submaps) {
|
||||
map_load<D, C>(tyler, parFileOpener, name, parPusher);
|
||||
map_load<PixConv, C>(tyler, parFileOpener, name, parPusher);
|
||||
}
|
||||
return std::move(tyler);
|
||||
}
|
||||
|
||||
template <uint32_t D, typename C>
|
||||
dk::Tyler<D>& map_load (dk::Tyler<D>& parTyler, C& parFileOpener, const std::string& parOpen, const PushLayerMapType<D>& parPusher) {
|
||||
template <typename PixConv, typename C>
|
||||
dk::Tyler<PixConv>& map_load (dk::Tyler<PixConv>& parTyler, C& parFileOpener, const std::string& parOpen, const PushLayerMapType<PixConv>& parPusher) {
|
||||
constexpr uint32_t dimensions = PixConv::dimensions;
|
||||
std::stack<std::string, std::vector<std::string>> name_stack;
|
||||
std::vector<std::string> submaps;
|
||||
name_stack.push(parOpen);
|
||||
|
||||
do {
|
||||
dk::BaseMapSource<D>* reader = parFileOpener(name_stack.top());
|
||||
dk::BaseMapSource<dimensions>* reader = parFileOpener(name_stack.top());
|
||||
name_stack.pop();
|
||||
|
||||
submaps.clear();
|
||||
|
@ -48,14 +50,14 @@ namespace dkh {
|
|||
}
|
||||
|
||||
for (int z = 0; z < reader->layersCount(); ++z) {
|
||||
implem::call_push_layer<D>(parTyler, parPusher, reader, z);
|
||||
implem::call_push_layer(parTyler, parPusher, reader, z);
|
||||
}
|
||||
} while (not name_stack.empty());
|
||||
return parTyler;
|
||||
}
|
||||
|
||||
template <uint32_t D, typename C>
|
||||
dk::BaseMapSource<D>* MapLoaderPool<D, C>::operator() (const std::string& parName) {
|
||||
template <typename PixConv, typename C>
|
||||
auto MapLoaderPool<PixConv, C>::operator() (const std::string& parName) -> dk::BaseMapSource<dimensions>* {
|
||||
auto it_found = pool.find(parName);
|
||||
if (pool.end() != it_found) {
|
||||
return it_found->second.get();
|
||||
|
@ -69,18 +71,18 @@ namespace dkh {
|
|||
}
|
||||
|
||||
template <typename M>
|
||||
dk::Tyler<M::dimensions> call_map_load (M& parFileOpener, const std::string& parOpen, const PushLayerMapType<M::dimensions>& parPusher) {
|
||||
return map_load<M::dimensions, M>(parFileOpener, parOpen, parPusher);
|
||||
dk::Tyler<typename M::PixelConvType> call_map_load (M& parFileOpener, const std::string& parOpen, const PushLayerMapType<typename M::PixelConvType>& parPusher) {
|
||||
return map_load<typename M::PixelConvType, M>(parFileOpener, parOpen, parPusher);
|
||||
}
|
||||
|
||||
template <typename M>
|
||||
dk::Tyler<M::dimensions> call_map_load (dk::Tyler<M::dimensions>& parTyler, M& parFileOpener, const std::string& parOpen, const PushLayerMapType<M::dimensions>& parPusher) {
|
||||
return map_load<M::dimensions, M>(parTyler, parFileOpener, parOpen, parPusher);
|
||||
dk::Tyler<typename M::PixelConvType> call_map_load (dk::Tyler<typename M::PixelConvType>& parTyler, M& parFileOpener, const std::string& parOpen, const PushLayerMapType<typename M::PixelConvType>& parPusher) {
|
||||
return map_load<typename M::PixelConvType, M>(parTyler, parFileOpener, parOpen, parPusher);
|
||||
}
|
||||
|
||||
namespace implem {
|
||||
template <uint32_t D>
|
||||
void call_push_layer (dk::Tyler<D>& parTyler, const PushLayerMapType<D>& parPusher, dk::BaseMapSource<D>* parReader, int parLayerIndex) {
|
||||
template <typename PixConv>
|
||||
void call_push_layer (dk::Tyler<PixConv>& parTyler, const PushLayerMapType<PixConv>& parPusher, dk::BaseMapSource<PixConv::dimensions>* parReader, int parLayerIndex) {
|
||||
auto it_found = parPusher.find(parReader->layerTypeHash(parLayerIndex));
|
||||
if (parPusher.end() == it_found)
|
||||
throw UnknownLayerTemplateException();
|
||||
|
|
|
@ -16,6 +16,36 @@
|
|||
*/
|
||||
|
||||
namespace dk {
|
||||
template <CoordinateScalarType DivX, CoordinateScalarType DivY>
|
||||
PixelConvDiamond<DivX, DivY>::PixelConvDiamond (const coords& parTileSize, bool parStaggered, bool parFirstReentrant) :
|
||||
base_class(parStaggered ? MapType_IsometricStaggered : MapType_Isometric, parTileSize),
|
||||
m_first_reentr(parFirstReentrant ? 1 : 0),
|
||||
m_staggered(parStaggered)
|
||||
{
|
||||
}
|
||||
|
||||
template <CoordinateScalarType DivX, CoordinateScalarType DivY>
|
||||
auto PixelConvDiamond<DivX, DivY>::to_pixel (const coords& parFrom) const -> coords {
|
||||
if (m_staggered) {
|
||||
const auto from(parFrom);
|
||||
const CoordinateScalarType xoffs = m_first_reentr xor (from.y() bitand 1);
|
||||
const auto& tile_size = this->tile_size();
|
||||
|
||||
const auto retval(from * tile_size + coords(xoffs * tile_size.x() / 2, 0));
|
||||
return coords(retval.x() / DivX, retval.y() / DivY);
|
||||
}
|
||||
else {
|
||||
DK_ASSERT(false); //not implemented
|
||||
return coords(0);
|
||||
}
|
||||
}
|
||||
|
||||
template <CoordinateScalarType DivX, CoordinateScalarType DivY>
|
||||
auto PixelConvDiamond<DivX, DivY>::pick_tile (const coords& parPixelPoint) const -> coords {
|
||||
DK_ASSERT(false); //not implemented
|
||||
return coords(0);
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
PixelConv<D>::PixelConv (MapTypes parType, const coords& parTileSize) :
|
||||
m_tile_size(parTileSize),
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
namespace dk {
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <uint32_t D>
|
||||
Tyler<D>::Tyler (const coords& parTileSize) :
|
||||
template <typename PixConv>
|
||||
Tyler<PixConv>::Tyler (const coords& parTileSize) :
|
||||
m_size(0),
|
||||
m_tilesize(parTileSize)
|
||||
{
|
||||
|
@ -27,10 +27,10 @@ namespace dk {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <uint32_t D>
|
||||
typename Tyler<D>::coords::scalar_type Tyler<D>::tiles_count() const {
|
||||
template <typename PixConv>
|
||||
typename Tyler<PixConv>::coords::scalar_type Tyler<PixConv>::tiles_count() const {
|
||||
typename coords::scalar_type retval = 1;
|
||||
for (uint32_t d = 0; d < D; ++d) {
|
||||
for (uint32_t d = 0; d < dimensions; ++d) {
|
||||
retval *= m_size[d];
|
||||
}
|
||||
return retval;
|
||||
|
@ -38,21 +38,21 @@ namespace dk {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
Layer<T, D>& Tyler<D>::push_layer (BaseMapSource<D>* parTilemap, int parIndex) {
|
||||
Layer<T, PixConv>& Tyler<PixConv>::push_layer (BaseMapSource<dimensions>* parTilemap, int parIndex) {
|
||||
return push_layer<T>(parTilemap, coords(static_cast<CoordinateScalarType>(1)), parIndex);
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
Layer<T, D>& Tyler<D>::push_layer (BaseMapSource<D>* parTilemap, const coords& parSubdiv, int parIndex) {
|
||||
Layer<T, PixConv>& Tyler<PixConv>::push_layer (BaseMapSource<dimensions>* parTilemap, const coords& parSubdiv, int parIndex) {
|
||||
//TODO: store the index
|
||||
(void)parIndex;
|
||||
|
||||
auto newLayer = new Layer<T, D>(m_tilesize / parSubdiv, m_tilesize, parTilemap);
|
||||
auto newLayer = new Layer<T, PixConv>(m_tilesize / parSubdiv, m_tilesize, parTilemap);
|
||||
if (m_size == coords(0)) {
|
||||
m_size = newLayer->mapSize();
|
||||
}
|
||||
|
@ -69,16 +69,16 @@ namespace dk {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
void Tyler<D>::push_layer_void (BaseMapSource<D>* parTilemap, int parIndex) {
|
||||
void Tyler<PixConv>::push_layer_void (BaseMapSource<dimensions>* parTilemap, int parIndex) {
|
||||
push_layer<T>(parTilemap, parIndex);
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <uint32_t D>
|
||||
void Tyler<D>::preload (const coords& parFrom, const coords& parTo) {
|
||||
template <typename PixConv>
|
||||
void Tyler<PixConv>::preload (const coords& parFrom, const coords& parTo) {
|
||||
for (auto& layer : m_layers) {
|
||||
layer->preload(parFrom, parTo);
|
||||
}
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
*/
|
||||
|
||||
namespace dk {
|
||||
template <uint32_t D>
|
||||
Viewport<D>::Viewport (Tyler<D>& parTyler) :
|
||||
template <typename PixConv>
|
||||
Viewport<PixConv>::Viewport (Tyler<PixConv>& parTyler) :
|
||||
m_tyler(parTyler)
|
||||
{
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
Viewport<D>::Viewport (Tyler<D>& parTyler, const coords& parSize, const coords& parPos) :
|
||||
template <typename PixConv>
|
||||
Viewport<PixConv>::Viewport (Tyler<PixConv>& parTyler, const coords& parSize, const coords& parPos) :
|
||||
m_size(parSize),
|
||||
m_position(parPos),
|
||||
m_tyler(parTyler)
|
||||
|
@ -33,64 +33,64 @@ namespace dk {
|
|||
m_tyler.preload(m_position, m_position + m_size);
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
typename Layer<T, D>::iterator Viewport<D>::begin (Layer<T, D>& parLayer) const {
|
||||
typedef typename Layer<T, D>::iterator IterType;
|
||||
typename Layer<T, PixConv>::iterator Viewport<PixConv>::begin (Layer<T, PixConv>& parLayer) const {
|
||||
typedef typename Layer<T, PixConv>::iterator IterType;
|
||||
return IterType(&parLayer.m_tiles, parLayer.m_tilemap->pixel_conv(), m_position, m_tyler.map_size() - 1);
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
typename Layer<T, D>::iterator Viewport<D>::end (Layer<T, D>& parLayer) const {
|
||||
typedef typename Layer<T, D>::iterator IterType;
|
||||
return IterType(&parLayer.m_tiles, parLayer.m_tilemap->pixel_conv(), make_past_end_coords<D>(m_tyler.map_size() - 1), make_past_end_coords<D>(m_tyler.map_size() - 1));
|
||||
typename Layer<T, PixConv>::iterator Viewport<PixConv>::end (Layer<T, PixConv>& parLayer) const {
|
||||
typedef typename Layer<T, PixConv>::iterator IterType;
|
||||
return IterType(&parLayer.m_tiles, parLayer.m_tilemap->pixel_conv(), make_past_end_coords<dimensions>(m_tyler.map_size() - 1), make_past_end_coords<dimensions>(m_tyler.map_size() - 1));
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
typename Layer<T, D>::const_iterator Viewport<D>::begin (const Layer<T, D>& parLayer) const {
|
||||
typename Layer<T, PixConv>::const_iterator Viewport<PixConv>::begin (const Layer<T, PixConv>& parLayer) const {
|
||||
return this->cbegin(parLayer);
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
typename Layer<T, D>::const_iterator Viewport<D>::end (const Layer<T, D>& parLayer) const {
|
||||
typename Layer<T, PixConv>::const_iterator Viewport<PixConv>::end (const Layer<T, PixConv>& parLayer) const {
|
||||
return this->cend(parLayer);
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
typename Layer<T, D>::const_iterator Viewport<D>::cbegin (const Layer<T, D>& parLayer) const {
|
||||
typedef typename Layer<T, D>::const_iterator IterType;
|
||||
typename Layer<T, PixConv>::const_iterator Viewport<PixConv>::cbegin (const Layer<T, PixConv>& parLayer) const {
|
||||
typedef typename Layer<T, PixConv>::const_iterator IterType;
|
||||
return IterType(&parLayer.m_tiles, parLayer.m_tilemap->pixel_conv(), m_position, m_tyler.map_size() - 1);
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
template <typename PixConv>
|
||||
template <typename T>
|
||||
typename Layer<T, D>::const_iterator Viewport<D>::cend (const Layer<T, D>& parLayer) const {
|
||||
typedef typename Layer<T, D>::const_iterator IterType;
|
||||
return IterType(&parLayer.m_tiles, parLayer.m_tilemap->pixel_conv(), make_past_end_coords<D>(m_tyler.map_size() - 1), make_past_end_coords<D>(m_tyler.map_size() - 1));
|
||||
typename Layer<T, PixConv>::const_iterator Viewport<PixConv>::cend (const Layer<T, PixConv>& parLayer) const {
|
||||
typedef typename Layer<T, PixConv>::const_iterator IterType;
|
||||
return IterType(&parLayer.m_tiles, parLayer.m_tilemap->pixel_conv(), make_past_end_coords<dimensions>(m_tyler.map_size() - 1), make_past_end_coords<dimensions>(m_tyler.map_size() - 1));
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
void Viewport<D>::setSize (const coords& parSize) {
|
||||
template <typename PixConv>
|
||||
void Viewport<PixConv>::setSize (const coords& parSize) {
|
||||
DK_ASSERT(m_position <= m_position + parSize);
|
||||
DK_ASSERT(parSize + m_position <= m_tyler.map_size());
|
||||
m_size = parSize;
|
||||
m_tyler.preload(m_position, m_position + m_size);
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
void Viewport<D>::setFrom (const coords& parFrom) {
|
||||
template <typename PixConv>
|
||||
void Viewport<PixConv>::setFrom (const coords& parFrom) {
|
||||
DK_ASSERT(parFrom <= parFrom + m_size);
|
||||
DK_ASSERT(m_size + parFrom <= m_tyler.map_size());
|
||||
m_position = parFrom;
|
||||
m_tyler.preload(m_position, m_position + m_size);
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
void Viewport<D>::setFromSize (const coords& parFrom, const coords& parSize) {
|
||||
template <typename PixConv>
|
||||
void Viewport<PixConv>::setFromSize (const coords& parFrom, const coords& parSize) {
|
||||
DK_ASSERT(parFrom <= parFrom + parSize);
|
||||
DK_ASSERT(parSize + parFrom <= m_tyler.map_size());
|
||||
m_position = parFrom;
|
||||
|
|
|
@ -18,42 +18,6 @@
|
|||
#include "doorkeeper/components/pixelconv.hpp"
|
||||
|
||||
namespace dk {
|
||||
PixelConvDiamond::PixelConvDiamond (const coords& parTileSize, bool parStaggered, bool parFirstReentrant) :
|
||||
base_class(parStaggered ? MapType_IsometricStaggered : MapType_Isometric, parTileSize),
|
||||
m_ratio(1),
|
||||
m_first_reentr(parFirstReentrant ? 1 : 0),
|
||||
m_staggered(parStaggered)
|
||||
{
|
||||
}
|
||||
|
||||
PixelConvDiamond::PixelConvDiamond (const coords& parTileSize, bool parStaggered, bool parFirstReentrant, const coords& parRatio) :
|
||||
base_class(MapType_IsometricStaggered, parTileSize),
|
||||
m_ratio(parRatio),
|
||||
m_first_reentr(parFirstReentrant ? 1 : 0),
|
||||
m_staggered(parStaggered)
|
||||
{
|
||||
DK_ASSERT(parRatio > 0);
|
||||
}
|
||||
|
||||
auto PixelConvDiamond::to_pixel (const coords& parFrom) const -> coords {
|
||||
if (m_staggered) {
|
||||
const auto from(parFrom);
|
||||
const CoordinateScalarType xoffs = m_first_reentr xor (from.y() bitand 1);
|
||||
const auto& tile_size = this->tile_size();
|
||||
|
||||
return (from * tile_size + coords(xoffs * tile_size.x() / 2, 0)) / m_ratio;
|
||||
}
|
||||
else {
|
||||
DK_ASSERT(false); //not implemented
|
||||
return coords(0);
|
||||
}
|
||||
}
|
||||
|
||||
auto PixelConvDiamond::pick_tile (const coords& parPixelPoint) const -> coords {
|
||||
DK_ASSERT(false); //not implemented
|
||||
return coords(0);
|
||||
}
|
||||
|
||||
PixelConvHex::PixelConvHex (const coords& parTileSize, bool parFirstReentrant) :
|
||||
base_class(MapType_Hex, parTileSize),
|
||||
m_first_reentr(parFirstReentrant ? 1 : 0)
|
||||
|
|
|
@ -34,10 +34,11 @@
|
|||
#include <SDL2/SDL_image.h>
|
||||
|
||||
namespace {
|
||||
typedef dk::Tyler<dk::PixelConvDiamond<1, 1>> TylerSquare2;
|
||||
template <typename T, typename T1>
|
||||
inline
|
||||
dk::Vector<2> get_diamond_coordinates (const dk::TileIterator<T, 2, T1>& parIterator, const dk::Vector<2>& parSize) {
|
||||
dk::PixelConvDiamond pconv(parSize, true, false);
|
||||
dk::PixelConvDiamond<1, 1> pconv(parSize, true, false);
|
||||
return pconv.to_pixel(parIterator->block_position());
|
||||
}
|
||||
} //unnamed namespace
|
||||
|
@ -45,7 +46,7 @@ namespace {
|
|||
template <typename Device, typename Tile>
|
||||
struct LayerWithData {
|
||||
std::unique_ptr<dkh::AsciiMapSource> device;
|
||||
dk::Layer<Tile, 2>* layer;
|
||||
dk::Layer<Tile, dk::PixelConvDiamond<1, 1>>* layer;
|
||||
std::string path;
|
||||
};
|
||||
|
||||
|
@ -54,6 +55,10 @@ namespace {
|
|||
typedef std::unique_ptr<SDL_Window, void(*)(SDL_Window*)> SDLWindowUPtr;
|
||||
typedef std::unique_ptr<SDL_Texture, void(*)(SDL_Texture*)> SDLTextureUPtr;
|
||||
|
||||
typedef dk::Tyler<dk::PixelConvDiamond<1, 1>> TylerDiamond2;
|
||||
typedef dk::Viewport<dk::PixelConvDiamond<1, 1>> ViewportDiamond2;
|
||||
typedef dk::Layer<int, dk::PixelConvDiamond<1, 1>> LayerDiamond2;
|
||||
|
||||
struct SDLSimple {
|
||||
SDLSimple ( void );
|
||||
~SDLSimple ( void ) noexcept;
|
||||
|
@ -61,14 +66,14 @@ namespace {
|
|||
};
|
||||
|
||||
void printWelcome ( void );
|
||||
void addLayer ( dk::Tyler<2>& parTiler, LayerWithData<dkh::AsciiMapSource, int>& parLayerInfo, const char* parPath );
|
||||
void printViewport ( const dk::Viewport<2>& parView, const dk::Layer<int, 2>& parLayer );
|
||||
void addLayer ( TylerSquare2& parTiler, LayerWithData<dkh::AsciiMapSource, int>& parLayerInfo, const char* parPath );
|
||||
void printViewport ( const ViewportDiamond2& parView, const LayerDiamond2& parLayer );
|
||||
std::pair<int, std::string> GetRenderingDriver ( void );
|
||||
void draw_tiles ( SDL_Renderer* parRenderer, SDL_Texture* parTile0, SDL_Texture* parTile1, const dk::Viewport<2>& parView, const dk::Layer<int, 2>& parLayer, int parYOffs );
|
||||
void draw_tiles ( SDL_Renderer* parRenderer, SDL_Texture* parTile0, SDL_Texture* parTile1, const ViewportDiamond2& parView, const LayerDiamond2& parLayer, int parYOffs );
|
||||
} //unnamed namespace
|
||||
|
||||
int main() {
|
||||
typedef dk::Tyler<2>::coords coords2;
|
||||
typedef TylerSquare2::coords coords2;
|
||||
using dkh::AsciiMapSource;
|
||||
|
||||
SDLSimple sdl_init;
|
||||
|
@ -87,7 +92,7 @@ int main() {
|
|||
&SDL_DestroyRenderer
|
||||
);
|
||||
|
||||
dk::Tyler<2> tiler(coords2(64));
|
||||
TylerSquare2 tiler(coords2(64));
|
||||
|
||||
LayerWithData<AsciiMapSource, int> bottomLayer;
|
||||
addLayer(tiler, bottomLayer, DATA_PATH"/test.map");
|
||||
|
@ -95,8 +100,8 @@ int main() {
|
|||
LayerWithData<AsciiMapSource, int> topLayer;
|
||||
addLayer(tiler, topLayer, DATA_PATH"/test_2.map");
|
||||
|
||||
printViewport(dk::Viewport<2>(tiler, coords2(10, 6), coords2(0)), *bottomLayer.layer);
|
||||
printViewport(dk::Viewport<2>(tiler, coords2(4, 4), coords2(0)), *bottomLayer.layer);
|
||||
printViewport(ViewportDiamond2(tiler, coords2(10, 6), coords2(0)), *bottomLayer.layer);
|
||||
printViewport(ViewportDiamond2(tiler, coords2(4, 4), coords2(0)), *bottomLayer.layer);
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
std::cout << "Map size: " << tiler.map_size() << '\n';
|
||||
|
@ -113,7 +118,7 @@ int main() {
|
|||
//Main loop
|
||||
bool running = true;
|
||||
int y = 0;
|
||||
dk::Viewport<2> viewport(tiler, coords2(10, 8), coords2(0));
|
||||
ViewportDiamond2 viewport(tiler, coords2(10, 8), coords2(0));
|
||||
coords2 tile_size;
|
||||
SDL_QueryTexture(tile_0.get(), nullptr, nullptr, &tile_size.x(), &tile_size.y());
|
||||
do {
|
||||
|
@ -164,7 +169,7 @@ namespace {
|
|||
std::cout << '\n';
|
||||
}
|
||||
|
||||
void addLayer (dk::Tyler<2>& parTiler, LayerWithData<dkh::AsciiMapSource, int>& parLayerInfo, const char* parPath) {
|
||||
void addLayer (TylerSquare2& parTiler, LayerWithData<dkh::AsciiMapSource, int>& parLayerInfo, const char* parPath) {
|
||||
typedef dkh::AsciiMapSource::coords coords;
|
||||
|
||||
parLayerInfo.path = parPath;
|
||||
|
@ -172,7 +177,7 @@ namespace {
|
|||
parLayerInfo.layer = &parTiler.push_layer<int>(parLayerInfo.device.get(), 0);
|
||||
}
|
||||
|
||||
void printViewport (const dk::Viewport<2>& parView, const dk::Layer<int, 2>& parLayer) {
|
||||
void printViewport (const ViewportDiamond2& parView, const LayerDiamond2& parLayer) {
|
||||
int col = 0;
|
||||
const auto tilecount = parView.count();
|
||||
for (auto itTile = parView.begin(parLayer), itTileEND = parView.end(parLayer); itTile != itTileEND; ++itTile) {
|
||||
|
@ -231,8 +236,8 @@ namespace {
|
|||
return RetPairType(-1, "default");
|
||||
}
|
||||
|
||||
void draw_tiles (SDL_Renderer* parRenderer, SDL_Texture* parTile0, SDL_Texture* parTile1, const dk::Viewport<2>& parView, const dk::Layer<int, 2>& parLayer, int parYOffs) {
|
||||
typedef dk::Tyler<2>::coords coords2;
|
||||
void draw_tiles (SDL_Renderer* parRenderer, SDL_Texture* parTile0, SDL_Texture* parTile1, const ViewportDiamond2& parView, const LayerDiamond2& parLayer, int parYOffs) {
|
||||
typedef TylerSquare2::coords coords2;
|
||||
SDL_Rect rect_src;
|
||||
rect_src.x = rect_src.y = 0;
|
||||
coords2 original_size;
|
||||
|
|
|
@ -44,7 +44,7 @@ void asciimapsource::SetUp() {
|
|||
}
|
||||
|
||||
TEST_F(asciimapsource, load) {
|
||||
dk::Viewport<2> full_view(tiler, coords2(map_width, map_height), coords2(0));
|
||||
dk::Viewport<PixelConvType> full_view(tiler, coords2(map_width, map_height), coords2(0));
|
||||
|
||||
EXPECT_EQ(coords2(map_width, map_height), tiler.map_size());
|
||||
|
||||
|
@ -68,10 +68,10 @@ TEST_F(asciimapsource, load) {
|
|||
|
||||
TEST_F(asciimapsource, coordinates) {
|
||||
const coords2 tsize(tile_size);
|
||||
dk::Viewport<2> full_view(tiler, coords2(map_width, map_height), coords2(0));
|
||||
dk::PixelConvSquare<2> iso_conv((tsize));
|
||||
dk::PixelConvDiamond diamond_conv(tsize, true, false);
|
||||
dk::PixelConvDiamond diamond_conv2(tsize, true, true);
|
||||
dk::Viewport<PixelConvType> full_view(tiler, coords2(map_width, map_height), coords2(0));
|
||||
PixelConvType iso_conv((tsize));
|
||||
dk::PixelConvDiamond<1, 1> diamond_conv(tsize, true, false);
|
||||
dk::PixelConvDiamond<1, 1> diamond_conv2(tsize, true, true);
|
||||
|
||||
full_view.setFrom(coords2(0));
|
||||
for (auto itTile = full_view.begin(*layer), itTileEND = full_view.end(*layer); itTile != itTileEND; ++itTile) {
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
|
||||
class asciimapsource : public ::testing::Test {
|
||||
protected:
|
||||
typedef dk::Tyler<2>::coords coords2;
|
||||
typedef dk::Tyler<dk::PixelConvSquare<2>>::coords coords2;
|
||||
typedef std::unique_ptr<dkh::AsciiMapSource> AsciiMapSourceUPtr;
|
||||
typedef dk::PixelConvSquare<2> PixelConvType;
|
||||
|
||||
asciimapsource ( void );
|
||||
virtual ~asciimapsource ( void ) noexcept = default;
|
||||
|
@ -35,8 +36,8 @@ protected:
|
|||
static const dk::CoordinateScalarType map_width;
|
||||
static const dk::CoordinateScalarType map_height;
|
||||
|
||||
dk::Tyler<2> tiler;
|
||||
dk::Layer<dkh::AsciiMapSource::MapTileType, 2>* layer;
|
||||
dk::Tyler<dk::PixelConvSquare<2>> tiler;
|
||||
dk::Layer<dkh::AsciiMapSource::MapTileType, PixelConvType>* layer;
|
||||
AsciiMapSourceUPtr loader;
|
||||
};
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "doorkeeper/doorkeeper.hpp"
|
||||
#include "doorkeeper/helpers/maploader.hpp"
|
||||
#include "doorkeeper/helpers/tylermapsource.hpp"
|
||||
#include <iostream>
|
||||
#include <ciso646>
|
||||
|
|
Loading…
Add table
Reference in a new issue