57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
namespace dk {
|
|
template <typename T, typename T1>
|
|
inline
|
|
Vector<2> get_diamond_coordinates (const TileIterator<T, 2, T1>& parIterator, const Vector<2>& parSize) {
|
|
PixelConvDiamond pconv(parSize, true, false);
|
|
return pconv.to_pixel(parIterator.position());
|
|
}
|
|
|
|
template <typename T, typename T1>
|
|
inline
|
|
Vector<2> get_half_diamond_coordinates (const TileIterator<T, 2, T1>& parIterator, const Vector<2>& parSize) {
|
|
PixelConvDiamond pconv(parSize, true, false, PixelConvDiamond::coords(1, 2));
|
|
return pconv.to_pixel(parIterator.position());
|
|
}
|
|
|
|
template <uint32_t D, typename T, typename T1>
|
|
inline
|
|
Vector<D> get_square_coordinates (const TileIterator<T, D, T1>& parIterator, const Vector<D>& parSize) {
|
|
PixelConvSquare<D> pconv((parSize));
|
|
return pconv.to_pixel(parIterator.position());
|
|
}
|
|
|
|
template <typename T, typename T1>
|
|
inline
|
|
Vector<2> get_hex_coordinates (const TileIterator<T, 2, T1>& parIterator, const Vector<2>& parSize) {
|
|
PixelConvHex pconv(parSize, true);
|
|
return pconv.to_pixel(parIterator.position());
|
|
}
|
|
|
|
template <uint32_t D>
|
|
PixelConv<D>::PixelConv (MapTypes parType, const coords& parTileSize) :
|
|
m_tile_size(parTileSize),
|
|
m_map_type(parType)
|
|
{
|
|
}
|
|
|
|
template <uint32_t D>
|
|
MapTypes PixelConv<D>::map_type() const {
|
|
return m_map_type;
|
|
}
|
|
|
|
template <uint32_t D>
|
|
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)
|
|
{
|
|
}
|
|
|
|
template <uint32_t D>
|
|
auto PixelConvSquare<D>::to_pixel (const coords& parFrom) const -> coords {
|
|
return parFrom * this->tile_size();
|
|
}
|
|
} //namespace dk
|