41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
|
#include "doorkeeper/components/pixelconv.hpp"
|
||
|
|
||
|
namespace dk {
|
||
|
PixelConvDiamond::PixelConvDiamond (bool parStaggered, bool parFirstReentrant) :
|
||
|
base_class(parStaggered ? MapType_IsometricStaggered : MapType_Isometric)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
PixelConvDiamond::PixelConvDiamond (MapTypes parType, bool parStaggered, bool parFirstReentrant) :
|
||
|
base_class(MapType_IsometricStaggered)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
auto PixelConvDiamond::to_pixel (const coords& parFrom, const coords& parSize) const -> coords {
|
||
|
const auto from(parFrom);
|
||
|
const CoordinateScalarType xoffs = from.y() % 2;
|
||
|
|
||
|
return from * parSize + coords(xoffs * parSize.x() / 2, 0);
|
||
|
}
|
||
|
|
||
|
PixelConvHalfDiamond::PixelConvHalfDiamond (bool parHalfVertically) :
|
||
|
base_class(MapType_IsometricStaggered, true, true),
|
||
|
m_div(parHalfVertically ? coords(1, 2) : coords(2, 1))
|
||
|
{
|
||
|
}
|
||
|
|
||
|
auto PixelConvHalfDiamond::to_pixel (const coords& parFrom, const coords& parSize) const -> coords {
|
||
|
return base_class::to_pixel(parFrom, parSize / m_div);
|
||
|
}
|
||
|
|
||
|
PixelConvHex::PixelConvHex (bool parFirstReentrant) :
|
||
|
base_class(MapType_Hex)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
auto PixelConvHex::to_pixel (const coords& parFrom, const coords& parSize) const -> coords {
|
||
|
DK_ASSERT(false); //not implemented
|
||
|
return coords(0);
|
||
|
}
|
||
|
} //namespace dk
|