- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# C:/Documents and Settings/jegan/Desktop/projectX/Object.h

Go to the documentation of this file.

    00001 #pragma once
    00002
    00003 #include "SDL.h"
    00004
    00005 #include <string>
    00006
    00007
    00008 class List;
    00009
    00010 typedef enum { TILE, ENEMY, PLAYER, BULLET, EVENTPOINT, CAMERA, CUTSCENE, DOOR, BOSS } CollisionType;
    00011
    00012
    00013 class Object
    00014 {
    00015 public:
    00016         Object();
    00017         Object(List* objInfo, int x, int y);
    00018         virtual SDL_Rect getBox(){ return _box; };
    00019         virtual void collide( Object* o ){};
    00020         virtual void draw() = 0;
    00021         virtual void update(){};
    00022         virtual std::string id() {return _id;}
    00023         virtual void setId(std::string id){_id = id;}
    00024
    00025         virtual void setPos(int x, int y) {_box.x = x; _box.y = y;}
    00026
    00027         virtual void load(List *objInfo, bool fromConstructor = true) {}
    00028
    00029         static Object* loadObject(std::string filename, int x , int y );
    00030         //static Object* load(List * objInfo, int x, int y) =0;
    00031
    00032         virtual Object *copy(){return NULL;}
    00033
    00034         virtual void control(){};
    00035
    00036         // Accessor functions
    00037         bool collidable(){ return _collidable; };
    00038         void setCollidable( bool b ){ _collidable = b; };
    00039         bool solid(){ return _solid; };
    00040         void setSolid( bool b ){ _solid = b; };
    00041         double getDepth(){ return _depth; };
    00042         void setDepth( double depth ){ _depth = depth; };
    00043         CollisionType getType(){ return _type; };
    00044         void setType( CollisionType type ){ _type = type; };
    00045
    00046         std::string getId() {return _id;};
    00047
    00048 protected:
    00049         SDL_Rect _box;
    00050         bool _collidable;
    00051         bool _solid;
    00052         double _depth;
    00053
    00054         std::string _id;
    00055         CollisionType _type;
    00056 };