Original Post
I'm trying to create an efficient method for organising bitmaps into the order they'll be drawn onto the screen. Each bitmap about to be drawn to screen gets it's own 'LAYER' struct that holds information about such and such... Anyway,
If I haven't explained enough or more information is needed just say... Thanks in advance.
#ifndef LAYERS_H
#define LAYERS_H 1
#include <allegro.h>
#include <cstdlib>
#include <vector>
struct LAYER{
BITMAP* bmp;
int depth;
int x;
int y;
};
class REGISTER{
private:
vector<LAYER*> que;
vector<LAYER*> temp;
vector<LAYER*>::iterator pos;
vector<int> sorted;
public:
void add(LAYER* layer){
que.push_back(&layer);
}
void clear(){
que.erase(que.begin(), que.end());
}
void order(){
temp = que;
for(int i=0; i<que.size(); i++){
sorted.push_back(que->depth);
}
sort(sorted.begin(), sorted.end());
for(int a=0; a<que.size(); a++){
pos = temp.begin();
for(int b=0; b<temp.size(); b++){
if(temp->sorted == sorted[a]){
que[a] = temp;
temp.erase(pos, pos);
pos++;
break;
}
}
}
}
LAYER* list(){
if(que.size() > 0){
LAYER* list[que.size()];
for(int i=0; i<que.size(); i++){
list = que;
}
return list;
}
return NULL;
}
};
#endif
For some reason my compiler, Dev-Cpp, doesn't recognise 'LAYER' as a datatype (my conclusion). I get the following errors:
If I haven't explained enough or more information is needed just say... Thanks in advance.