2015-08-19 19:06:58 +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/>.
|
|
|
|
*/
|
|
|
|
|
2015-08-17 13:39:28 +00:00
|
|
|
namespace dk {
|
2015-08-17 15:36:45 +00:00
|
|
|
template <uint32_t D>
|
2015-08-17 22:00:59 +00:00
|
|
|
PixelConv<D>::PixelConv (MapTypes parType, const coords& parTileSize) :
|
|
|
|
m_tile_size(parTileSize),
|
2015-08-17 15:36:45 +00:00
|
|
|
m_map_type(parType)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
|
|
|
MapTypes PixelConv<D>::map_type() const {
|
|
|
|
return m_map_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
2015-08-17 22:00:59 +00:00
|
|
|
auto PixelConv<D>::tile_size() const -> const coords& {
|
|
|
|
return m_tile_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
|
|
|
PixelConvSquare<D>::PixelConvSquare (const coords& parTileSize) :
|
|
|
|
base_class(MapType_Orthogonal, parTileSize)
|
2015-08-17 15:36:45 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <uint32_t D>
|
2015-08-24 22:30:33 +00:00
|
|
|
auto PixelConvSquare<D>::to_pixel (const coords& parFrom, const coords& parOffset) const -> coords {
|
|
|
|
return (parFrom - parOffset) * this->tile_size();
|
2015-08-17 15:36:45 +00:00
|
|
|
}
|
2015-08-20 17:11:12 +00:00
|
|
|
|
|
|
|
template <uint32_t D>
|
2015-08-24 22:30:33 +00:00
|
|
|
auto PixelConvSquare<D>::pick_tile (const coords& parPixelPoint, const coords& parOffset) const -> coords {
|
|
|
|
return parPixelPoint / this->tile_size() + parOffset;
|
2015-08-20 17:11:12 +00:00
|
|
|
}
|
2015-08-17 13:39:28 +00:00
|
|
|
} //namespace dk
|