2014-12-12 19:04:48 +00:00
|
|
|
namespace dk {
|
2014-12-14 12:13:10 +00:00
|
|
|
template <size_t D>
|
|
|
|
Viewport<D>::Viewport (Tyler<D>& parTyler) :
|
|
|
|
m_tyler(parTyler)
|
2014-12-12 19:04:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-12-14 12:13:10 +00:00
|
|
|
template <size_t D>
|
|
|
|
Viewport<D>::Viewport (Tyler<D>& parTyler, const coords& parSize, const coords& parPos) :
|
2014-12-12 19:04:48 +00:00
|
|
|
m_size(parSize),
|
|
|
|
m_position(parPos),
|
2014-12-14 12:13:10 +00:00
|
|
|
m_tyler(parTyler)
|
2014-12-12 19:04:48 +00:00
|
|
|
{
|
2014-12-14 12:13:10 +00:00
|
|
|
m_tyler.preload(m_position, m_position + m_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <size_t D>
|
|
|
|
template <typename T>
|
|
|
|
typename Layer<T, D>::iterator Viewport<D>::begin (Layer<T, D>& parLayer) const {
|
|
|
|
typedef typename Layer<T, D>::iterator IterType;
|
|
|
|
|
|
|
|
return IterType(&parLayer.m_tiles, m_position, m_position + m_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <size_t D>
|
|
|
|
template <typename T>
|
|
|
|
typename Layer<T, D>::iterator Viewport<D>::end (Layer<T, D>& parLayer) const {
|
|
|
|
typedef typename Layer<T, D>::iterator IterType;
|
|
|
|
|
|
|
|
const auto to(m_position + m_size);
|
|
|
|
return IterType(&parLayer.m_tiles, implem::buildPastEndCoordinate(m_position, to), to);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <size_t D>
|
|
|
|
void Viewport<D>::setSize (const coords& parSize) {
|
|
|
|
m_size = parSize;
|
|
|
|
m_tyler.preload(m_position, m_position + m_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <size_t D>
|
|
|
|
void Viewport<D>::setFrom (const coords& parFrom) {
|
|
|
|
m_position = parFrom;
|
|
|
|
m_tyler.preload(m_position, m_position + m_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <size_t D>
|
|
|
|
void Viewport<D>::setFromSize (const coords& parFrom, const coords& parSize) {
|
|
|
|
m_position = parFrom;
|
|
|
|
m_size = parSize;
|
|
|
|
m_tyler.preload(m_position, m_position + m_size);
|
2014-12-12 19:04:48 +00:00
|
|
|
}
|
|
|
|
} //namespace dk
|