Fixed x,y in Entity constructor not being pro_maat::GridUnit

This commit is contained in:
Teo-CD 2019-06-09 15:56:54 +02:00
parent 4ed9180694
commit febe0827ad
2 changed files with 3 additions and 2 deletions

View file

@ -10,7 +10,7 @@ const std::map<std::string,EntityType> Entity::entityTypeLookup = {
{"House",EntityType::House}, {"House",EntityType::House},
{"Car",EntityType::Car}}; {"Car",EntityType::Car}};
Entity::Entity(int x, int y, EntityType type, sf::Texture* texture, int width, int height) : type(type) Entity::Entity(pro_maat::GridUnit x, pro_maat::GridUnit y, EntityType type, sf::Texture* texture, int width, int height) : type(type)
{ {
shape = sf::RectangleShape(sf::Vector2f(width*pro_maat::pixelsPerUnit,height*pro_maat::pixelsPerUnit)); shape = sf::RectangleShape(sf::Vector2f(width*pro_maat::pixelsPerUnit,height*pro_maat::pixelsPerUnit));
// Sets the origin at the center of the entity // Sets the origin at the center of the entity

View file

@ -42,7 +42,8 @@ class Entity
{ {
public: public:
/// x,y, width and height are in grid coordinates /// x,y, width and height are in grid coordinates
Entity(int x, int y, EntityType type, sf::Texture* texture, int width = 1, int height = 1); Entity(pro_maat::GridUnit x, pro_maat::GridUnit y, EntityType type, sf::Texture* texture, int width = 1,
int height = 1);
explicit Entity(const pugi::xml_node& entityNode, sf::Texture* texture); explicit Entity(const pugi::xml_node& entityNode, sf::Texture* texture);
void move(Orientation orientation); void move(Orientation orientation);