DoorKeeper/include/doorkeeper/implem/iterableviewport.hpp
2015-09-01 17:39:39 +02:00

50 lines
1.4 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/>.
*/
#ifndef idD358B9737CC045D3B35F2B5C2FCF84FA
#define idD358B9737CC045D3B35F2B5C2FCF84FA
#include "doorkeeper/components/viewport.hpp"
#include <cstdint>
namespace dk {
template <uint32_t D>
class LayerBase;
template <uint32_t D>
class IterableViewport {
public:
typedef typename Viewport<D>::coords coords;
IterableViewport ( const Viewport<D>* parViewport, const LayerBase<D>* parLayerBase ) :
m_viewport(parViewport),
m_layer(parLayerBase)
{
DK_ASSERT(m_viewport);
DK_ASSERT(m_layer);
}
void each_tile ( void ) const { m_layer->each_tile(*m_viewport); }
coords size ( void ) const { return m_viewport->size(); }
private:
const Viewport<D>* const m_viewport;
const LayerBase<D>* const m_layer;
};
} //namespace dk
#endif