G'day
This is not directly relevant to SFML by the way but I thought I might receive assistance nevertheless
So what I'm trying to do is sort the tiles in my level editor for drawing. For that purpose I use std::sort(). Problem is that it's not working. I pass in a static class function declared like so:
// Canvas Cell Painter
class Painter {
private:
...
// Place in "grid" that stores Tiles and collision "shapes"
struct Cell {
...
int order; // Drawing order
...
Cell(int ind[], Area* par, sf::Texture* tex) {
...
order = pos[1]-pos[2]; //For draw sorting
// Add this to parent
parent = par;
parent->cells.push_back(this);
...
}
}
...
public:
...
static bool cmp_cells(Cell* a, Cell* b);
...
};
...and defined like this:
bool Painter::cmp_cells(Painter::Cell* a, Painter::Cell* b) {
return (a->order<b->order);
}
...and expect it to work when I do:
void Painter::paintbrush(double px, double py, double pz, sf::Texture* texture) {
...
Area* a = new Area(pos, dim);
// Put a cell in Area
int zero[3] = { 0,0,0 };
Cell* c = new Cell(zero, a, texture);
std::sort(a->cells.begin(), a->cells.end(), Painter::cmp_cells);
...
}
But it doesn't =(
Any ideas people?
I'm clueless... thanks for your time anyway
[attachment deleted by admin]