Correction de l'ordre d'affichage des objets
This commit is contained in:
parent
af18582e19
commit
2455c2f845
|
@ -75,7 +75,7 @@ void Engine::draw() {
|
|||
window.clear(sf::Color(66, 165, 245));
|
||||
|
||||
// chargement de la file d'affichage des objets
|
||||
std::priority_queue<Object*, std::vector<Object*>, CompareObjectLayer> display_queue;
|
||||
std::priority_queue<Object*, std::vector<Object*>, ObjectCompare> display_queue;
|
||||
|
||||
for (unsigned int i = 0; i < objects.size(); i++) {
|
||||
display_queue.push(objects[i]);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define __PTF_OBJECT_HPP__
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <iostream>
|
||||
#include "state.hpp"
|
||||
|
||||
class Object {
|
||||
|
@ -51,9 +50,9 @@ public:
|
|||
* Renvoie "true" si le premier objet est sur une couche
|
||||
* qui doit être dessinée avant celle du second
|
||||
*/
|
||||
struct CompareObjectLayer {
|
||||
bool operator()(Object* const &obj1, Object* const &obj2) {
|
||||
return obj1->getLayer() < obj2->getLayer();
|
||||
struct ObjectCompare {
|
||||
bool operator()(Object* const &t1, Object* const &t2) {
|
||||
return t1->getLayer() > t2->getLayer();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue