Correction de l'ordre d'affichage des objets

This commit is contained in:
Mattéo Delabre 2016-03-10 22:47:53 +01:00
parent af18582e19
commit 2455c2f845
2 changed files with 5 additions and 6 deletions

View File

@ -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]);

View File

@ -2,7 +2,6 @@
#define __PTF_OBJECT_HPP__
#include <SFML/Graphics.hpp>
#include <iostream>
#include "state.hpp"
class Object {
@ -51,10 +50,10 @@ 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();
}
};
#endif