King_DuckZ
c9381a4585
Iterating through tiles in viewports now works fine. You can pass in a custom device as the data source for the tile map.
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#ifndef id0ADBCC15BA574485BF3267254090D99B
|
|
#define id0ADBCC15BA574485BF3267254090D99B
|
|
|
|
#include "primitivetypes.hpp"
|
|
#include "components/tileiterator.hpp"
|
|
#include "components/layer.hpp"
|
|
|
|
namespace dk {
|
|
template <size_t D>
|
|
class Tyler;
|
|
|
|
template <typename T, size_t D>
|
|
class Layer;
|
|
|
|
template <size_t D>
|
|
class Viewport {
|
|
public:
|
|
typedef Vector<CoordinateScalarType, D> coords;
|
|
|
|
explicit Viewport ( Tyler<D>& parTyler );
|
|
Viewport ( Tyler<D>& parTyler, const coords& parSize, const coords& parPos );
|
|
~Viewport ( void ) noexcept = default;
|
|
|
|
Viewport& operator= ( const Viewport& ) = default;
|
|
|
|
void setSize ( const coords& parSize );
|
|
void setFrom ( const coords& parFrom );
|
|
void setFromSize ( const coords& parFrom, const coords& parSize );
|
|
const coords& count ( void ) const { return m_size; }
|
|
|
|
template <typename T>
|
|
typename Layer<T, D>::iterator begin ( Layer<T, D>& parLayer ) const;
|
|
template <typename T>
|
|
typename Layer<T, D>::iterator end ( Layer<T, D>& parLayer ) const;
|
|
|
|
private:
|
|
coords m_size;
|
|
coords m_position;
|
|
Tyler<D>& m_tyler;
|
|
};
|
|
} //namespace dk
|
|
|
|
#include "implem/viewport.inl"
|
|
|
|
#endif
|