/* 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
PixelConv::PixelConv (MapTypes parType, const coords& parTileSize) :
m_tile_size(parTileSize),
m_map_type(parType)
{
}
template
MapTypes PixelConv::map_type() const {
return m_map_type;
}
template
auto PixelConv::tile_size() const -> const coords& {
return m_tile_size;
}
template
PixelConvSquare::PixelConvSquare (const coords& parTileSize) :
base_class(MapType_Orthogonal, parTileSize)
{
}
template
auto PixelConvSquare::to_pixel (const coords& parFrom, const coords& parOffset) const -> coords {
return (parFrom - parOffset) * this->tile_size();
}
template
auto PixelConvSquare::pick_tile (const coords& parPixelPoint, const coords& parOffset) const -> coords {
return parPixelPoint / this->tile_size() + parOffset;
}
} //namespace dk