Skip to main content
GameDev.net gamedev.net
🔒 Locked

Syntax problem

Started by Indolence Aug 28, 2006 at 11:42 AM 1 replies 800+ views
Original Post
Indolence
Indolence
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,

#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.
It is fun to be under knowledgeable.
Scet
Scet
Since it can't find "sort" and all the errors have to do with STL objects, my guess is that it needs to be a std::vector, or just include the std namespace.
Indolence
Indolence
Ahaha.. silly me.

Such a simple mistake -_-. Thankyou for pointing that out >.<
It is fun to be under knowledgeable.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.