Added type alias for std::pair<uint8_t,uint8_t> for grid coordinates as sf::Vector2 cannot be used in std::map or std::set
This commit is contained in:
parent
430d2b0307
commit
633fda8336
5 changed files with 24 additions and 12 deletions
|
@ -71,17 +71,17 @@ const State Entity::getState() const
|
|||
return currentState;
|
||||
}
|
||||
|
||||
const sf::Vector2i Entity::getPosition() const
|
||||
const pro_maat::GridPos Entity::getPosition() const
|
||||
{
|
||||
// Safe : size is a multiple of pro_maat::pixelsPerUnit
|
||||
uint8_t x = (shape.getPosition().x-0.5*shape.getSize().x)/pro_maat::pixelsPerUnit;
|
||||
uint8_t y = (shape.getPosition().y-0.5*shape.getSize().y)/pro_maat::pixelsPerUnit;
|
||||
return sf::Vector2i(x,y);
|
||||
return pro_maat::GridPos(x,y);
|
||||
}
|
||||
|
||||
const std::vector<std::pair<uint8_t, uint8_t>> Entity::getOccupiedSquares() const
|
||||
const std::vector<pro_maat::GridPos> Entity::getOccupiedSquares() const
|
||||
{
|
||||
std::vector<std::pair<uint8_t, uint8_t>> occupiedSquares;
|
||||
std::vector<pro_maat::GridPos> occupiedSquares;
|
||||
// Safe : size is a multiple of pro_maat::pixelsPerUnit
|
||||
uint8_t w = shape.getSize().x/pro_maat::pixelsPerUnit;
|
||||
uint8_t h = shape.getSize().y/pro_maat::pixelsPerUnit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue