Amélioration de l'ordre de profondeur

This commit is contained in:
Mattéo Delabre 2016-04-07 01:21:18 +02:00
parent 574a53ca90
commit fe7fdd43d5
1 changed files with 2 additions and 9 deletions

View File

@ -316,16 +316,9 @@ void Object::setLayer(int set_layer) {
}
bool ObjectCompare::operator()(ObjectPtr const &t1, ObjectPtr const &t2) const {
if (t1->getLayer() != t2->getLayer()) {
return t1->getLayer() > t2->getLayer();
}
sf::Vector2f t1_pos = t1->getPosition();
sf::Vector2f t2_pos = t2->getPosition();
if (t1_pos.y != t2_pos.y) {
return t1_pos.y < t2_pos.y;
}
return t1_pos.x > t2_pos.x;
return t1_pos.x - t1_pos.y + t1->getLayer() >
t2_pos.x - t2_pos.y + t2->getLayer();
}