/* 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 .
*/
namespace dk {
template
Tile::Tile (T* parData, const TileCoords& parPos, const coords& parBlockOffs, const PixelConv* parPConv) :
m_position(parPos),
m_block_offs(parBlockOffs),
m_pixconv(parPConv),
m_data(parData)
{
DK_ASSERT(m_pixconv);
DK_ASSERT(m_data);
}
template
const T& Tile::data() const {
return *m_data;
}
template
T& Tile::data() {
return *m_data;
}
template
auto Tile::block_position() const -> const coords& {
return m_position.position();
}
template
const TileCoords& Tile::raw_coords() const {
return m_position;
}
template
auto Tile::screen_position() const -> coords {
return m_pixconv->to_pixel(m_position.position(), m_block_offs);
}
} //namespace dk