/* 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 . */ #ifndef id0ADBCC15BA574485BF3267254090D99B #define id0ADBCC15BA574485BF3267254090D99B #include "doorkeeper/primitivetypes.hpp" #include "doorkeeper/components/tileiterator.hpp" #include "doorkeeper/components/layer.hpp" #include "doorkeeper/components/tilecoords.hpp" #include #include #include namespace dk { template class Tyler; template class Layer; template struct TileInfo { typedef Vector coords; TileInfo ( const LayerBase& parLayer ); coords tile_size; coords map_size; }; template std::size_t hash_value ( const TileInfo& parTProps ) noexcept a_pure; template class Viewport { public: typedef Vector coords; typedef VectorT coords_f; Viewport ( const Viewport& parOther ) = default; Viewport ( Tyler& parTyler, const TileInfo* parTileInfo ); Viewport ( Tyler& parTyler, const TileInfo* parTileInfo, const coords& parPos ); ~Viewport ( void ) noexcept = default; Viewport& operator= ( const Viewport& ) = default; Viewport& operator+= ( const coords_f& parValue ); Viewport& operator-= ( const coords_f& parValue ); void setFrom ( const coords& parFrom ); coords size ( void ) const; coords pixel_offset ( void ) const; template typename Layer::iterator begin ( Layer& parLayer ) const; template typename Layer::iterator end ( Layer& parLayer ) const; template inline typename Layer::const_iterator begin ( const Layer& parLayer ) const a_always_inline; template inline typename Layer::const_iterator end ( const Layer& parLayer ) const a_always_inline; template typename Layer::const_iterator cbegin ( const Layer& parLayer ) const; template typename Layer::const_iterator cend ( const Layer& parLayer ) const; void set_tile_info ( const TileInfo* parTileInfo ); private: void clip_pixel_offset ( void ); TileCoords m_view; coords_f m_pixel_offset; Tyler& m_tyler; const TileInfo* const m_tile_info; }; } //namespace dk #include "doorkeeper/implem/viewport.inl" #endif