#ifndef idD3EDC396AA314474B3D909559FFC0247 #define idD3EDC396AA314474B3D909559FFC0247 #include "doorkeeper/primitivetypes.hpp" #include "doorkeeper/components/tileiterator.hpp" #include "doorkeeper/components/basemapsource.hpp" #include "doorkeeper/implem/helpers.hpp" #include #include #include #include #if !defined(NDEBUG) #include #endif namespace dk { template class Viewport; template class LayerBase { public: typedef Vector coords; LayerBase ( const coords& parCount, const coords& parTileSize, const coords& parMasterTileSize ); virtual ~LayerBase ( void ) noexcept = default; void preload ( const coords& parFrom, const coords& parTo ); coords count ( void ) const { return m_mastersize / m_tilesize * m_count; } const coords& mapSize ( void ) const { return m_count; } protected: coords m_count; coords m_tilesize; coords m_mastersize; private: virtual void onPreload ( const coords& parFrom, const coords& parTo ) = 0; coords m_haveFrom; coords m_haveTo; }; template class Layer : public LayerBase { friend class Viewport; public: typedef typename LayerBase::coords coords; typedef TileIterator iterator; typedef TileIterator const_iterator; Layer ( const Layer& ) = delete; Layer ( Layer&& ) = default; Layer ( const coords& parTileSize, const coords& parMasterTileSize, BaseMapSource* parTilemap ); virtual ~Layer ( void ) noexcept = default; Layer& operator= ( const Layer& ) = delete; iterator begin ( void ); iterator end ( void ); private: virtual void onPreload ( const coords& parFrom, const coords& parTo ); std::vector m_tiles; BaseMapSource* m_tilemap; }; } //namespace dk #include "doorkeeper/implem/layer.inl" #endif