2015-08-17 13:39:28 +00:00
|
|
|
namespace dk {
|
2015-05-24 15:17:53 +00:00
|
|
|
template <typename T, typename T1>
|
|
|
|
inline
|
2015-08-17 15:36:45 +00:00
|
|
|
Vector<2> get_diamond_coordinates (const TileIterator<T, 2, T1>& parIterator, const Vector<2>& parSize) {
|
2015-08-17 22:00:59 +00:00
|
|
|
PixelConvDiamond pconv(parSize, true, false);
|
|
|
|
return pconv.to_pixel(parIterator.position());
|
2015-05-24 15:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T, typename T1>
|
|
|
|
inline
|
2015-08-17 15:36:45 +00:00
|
|
|
Vector<2> get_half_diamond_coordinates (const TileIterator<T, 2, T1>& parIterator, const Vector<2>& parSize) {
|
2015-08-17 22:00:59 +00:00
|
|
|
PixelConvDiamond pconv(parSize, true, false, PixelConvDiamond::coords(1, 2));
|
|
|
|
return pconv.to_pixel(parIterator.position());
|
2015-05-24 15:17:53 +00:00
|
|
|
}
|
|
|
|
|
2015-08-17 11:36:47 +00:00
|
|
|
template <uint32_t D, typename T, typename T1>
|
2015-05-24 15:17:53 +00:00
|
|
|
inline
|
2015-08-17 15:36:45 +00:00
|
|
|
Vector<D> get_square_coordinates (const TileIterator<T, D, T1>& parIterator, const Vector<D>& parSize) {
|
2015-08-17 22:00:59 +00:00
|
|
|
PixelConvSquare<D> pconv((parSize));
|
|
|
|
return pconv.to_pixel(parIterator.position());
|
2015-05-24 15:17:53 +00:00
|
|
|
}
|
|
|
|
|
2015-08-17 15:36:45 +00:00
|
|
|
template <typename T, typename T1>
|
|
|
|
inline
|
|
|
|
Vector<2> get_hex_coordinates (const TileIterator<T, 2, T1>& parIterator, const Vector<2>& parSize) {
|
2015-08-17 22:00:59 +00:00
|
|
|
PixelConvHex pconv(parSize, true);
|
|
|
|
return pconv.to_pixel(parIterator.position());
|
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-17 22:00:59 +00:00
|
|
|
auto PixelConvSquare<D>::to_pixel (const coords& parFrom) const -> coords {
|
|
|
|
return parFrom * this->tile_size();
|
2015-08-17 15:36:45 +00:00
|
|
|
}
|
2015-08-17 13:39:28 +00:00
|
|
|
} //namespace dk
|