2015-08-31 15:11:11 +00:00
|
|
|
/* 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:
|
2015-09-01 15:39:39 +00:00
|
|
|
typedef typename Viewport<D>::coords coords;
|
|
|
|
|
2015-08-31 15:11:11 +00:00
|
|
|
IterableViewport ( const Viewport<D>* parViewport, const LayerBase<D>* parLayerBase ) :
|
|
|
|
m_viewport(parViewport),
|
|
|
|
m_layer(parLayerBase)
|
|
|
|
{
|
|
|
|
DK_ASSERT(m_viewport);
|
|
|
|
DK_ASSERT(m_layer);
|
|
|
|
}
|
|
|
|
|
2015-09-01 15:39:39 +00:00
|
|
|
void each_tile ( void ) const { m_layer->each_tile(*m_viewport); }
|
|
|
|
coords size ( void ) const { return m_viewport->size(); }
|
2015-08-31 15:11:11 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const Viewport<D>* const m_viewport;
|
|
|
|
const LayerBase<D>* const m_layer;
|
|
|
|
};
|
|
|
|
} //namespace dk
|
|
|
|
|
|
|
|
#endif
|