Amélioration de l'ordre de profondeur
This commit is contained in:
parent
574a53ca90
commit
fe7fdd43d5
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue