80 lines
2.6 KiB
C++
80 lines
2.6 KiB
C++
/* 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/>.
|
|
*/
|
|
|
|
namespace dk {
|
|
template <uint32_t D>
|
|
LayeredViewport<D>::LayeredViewport (Tyler<D>& parTyler) :
|
|
m_tyler(parTyler)
|
|
{
|
|
}
|
|
|
|
template <uint32_t D>
|
|
LayeredViewport<D>::~LayeredViewport() {
|
|
}
|
|
|
|
template <uint32_t D>
|
|
LayeredViewport<D>& LayeredViewport<D>::operator+= (const coords_f& parValue) {
|
|
for (auto& view : m_views) {
|
|
view.second += parValue;
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
template <uint32_t D>
|
|
LayeredViewport<D>& LayeredViewport<D>::operator-= (const coords_f& parValue) {
|
|
for (auto& view : m_views) {
|
|
view.second -= parValue;
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
template <uint32_t D>
|
|
void LayeredViewport<D>::on_layer_added (const LayerBase<D>* parLayer) {
|
|
}
|
|
|
|
template <uint32_t D>
|
|
void LayeredViewport<D>::on_layer_removed (const LayerBase<D>* parLayer) {
|
|
}
|
|
|
|
template <uint32_t D>
|
|
auto LayeredViewport<D>::begin() -> iterator {
|
|
return iterator(m_view.begin(), std::bind(&LayeredViewport<D>::viewport, this, std::placeholders::_1));
|
|
|
|
template <uint32_t D>
|
|
auto LayeredViewport<D>::begin() const -> const_iterator {
|
|
return const_iterator(m_view.begin(), std::bind(&LayeredViewport<D>::viewport, this, std::placeholders::_1));
|
|
}
|
|
|
|
template <uint32_t D>
|
|
auto LayeredViewport<D>::end() -> iterator {
|
|
return iterator(m_view.end(), std::bind(&LayeredViewport<D>::viewport, this, std::placeholders::_1));
|
|
|
|
template <uint32_t D>
|
|
auto LayeredViewport<D>::end() const -> const_iterator {
|
|
return const_iterator(m_view.end(), std::bind(&LayeredViewport<D>::viewport, this, std::placeholders::_1));
|
|
}
|
|
|
|
template <uint32_t D>
|
|
Viewport<D>& LayeredViewport<D>::viewport (const LayerBase<D>& parLayer) {
|
|
return const_cast<Viewport<D>&>(const_cast<const LayeredViewport<D>*>(this)->viewport(parLayer));
|
|
|
|
template <uint32_t D>
|
|
const Viewport<D>& LayeredViewport<D>::viewport (const LayerBase<D>& parLayer) const {
|
|
const TileInfo tinfo { parLayer.tile_size(), parLayer.map_size() };
|
|
return m_views[tinfo];
|
|
}
|
|
} //namespace dk
|