Add pick_tile() method (not implemented yet).
This commit is contained in:
parent
e001f46dbe
commit
5a9d497183
3 changed files with 25 additions and 1 deletions
|
@ -35,6 +35,8 @@ namespace dk {
|
|||
PixelConv ( MapTypes parType, const coords& parTileSize );
|
||||
|
||||
virtual coords to_pixel ( const coords& parFrom ) const = 0;
|
||||
virtual coords pick_tile ( const coords& parPixelPoint ) const = 0;
|
||||
|
||||
MapTypes map_type ( void ) const;
|
||||
const coords& tile_size ( void ) const;
|
||||
|
||||
|
@ -53,6 +55,7 @@ namespace dk {
|
|||
virtual ~PixelConvSquare ( void ) noexcept = default;
|
||||
|
||||
virtual coords to_pixel ( const coords& parFrom ) const;
|
||||
virtual coords pick_tile ( const coords& parPixelPoint ) const;
|
||||
};
|
||||
|
||||
class PixelConvDiamond : public PixelConv<2> {
|
||||
|
@ -65,6 +68,7 @@ namespace dk {
|
|||
virtual ~PixelConvDiamond ( void ) noexcept = default;
|
||||
|
||||
virtual coords to_pixel ( const coords& parFrom ) const;
|
||||
virtual coords pick_tile ( const coords& parPixelPoint ) const;
|
||||
|
||||
protected:
|
||||
const coords m_ratio;
|
||||
|
@ -81,6 +85,10 @@ namespace dk {
|
|||
virtual ~PixelConvHex ( void ) noexcept = default;
|
||||
|
||||
virtual coords to_pixel ( const coords& parFrom ) const;
|
||||
virtual coords pick_tile ( const coords& parPixelPoint ) const;
|
||||
|
||||
private:
|
||||
const CoordinateScalarType m_first_reentr;
|
||||
};
|
||||
|
||||
template <typename T, typename T1>
|
||||
|
|
|
@ -71,4 +71,9 @@ namespace dk {
|
|||
auto PixelConvSquare<D>::to_pixel (const coords& parFrom) const -> coords {
|
||||
return parFrom * this->tile_size();
|
||||
}
|
||||
|
||||
template <uint32_t D>
|
||||
auto PixelConvSquare<D>::pick_tile (const coords& parPixelPoint) const -> coords {
|
||||
return parPixelPoint / this->tile_size();
|
||||
}
|
||||
} //namespace dk
|
||||
|
|
|
@ -49,8 +49,14 @@ namespace dk {
|
|||
}
|
||||
}
|
||||
|
||||
auto PixelConvDiamond::pick_tile (const coords& parPixelPoint) const -> coords {
|
||||
DK_ASSERT(false); //not implemented
|
||||
return coords(0);
|
||||
}
|
||||
|
||||
PixelConvHex::PixelConvHex (const coords& parTileSize, bool parFirstReentrant) :
|
||||
base_class(MapType_Hex, parTileSize)
|
||||
base_class(MapType_Hex, parTileSize),
|
||||
m_first_reentr(parFirstReentrant ? 1 : 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -58,4 +64,9 @@ namespace dk {
|
|||
DK_ASSERT(false); //not implemented
|
||||
return coords(0);
|
||||
}
|
||||
|
||||
auto PixelConvHex::pick_tile (const coords& parPixelPoint) const -> coords {
|
||||
DK_ASSERT(false); //not implemented
|
||||
return coords(0);
|
||||
}
|
||||
} //namespace dk
|
||||
|
|
Loading…
Reference in a new issue