00001 #ifndef TRENGINE_H
00002 #define TRENGINE_H
00003
00004 #include <vector>
00005 #include <set>
00006
00007
00008 class Scene;
00009 class Behaviour;
00010 class CollisionHandler;
00011 class Camera;
00012 class GameObject;
00013 class Screen;
00014 class Transform;
00015 class Collider;
00016 struct Ray;
00017 struct RayCastHit;
00018
00019 using namespace std;
00020
00021
00022 class TREngine{
00023
00024 private:
00025 TREngine(void);
00026
00027 static TREngine* instance;
00028
00029 Scene* scene;
00030 vector<Behaviour*>* updateQueue;
00031 CollisionHandler* collisionHandler;
00032 vector<GameObject*> objects;
00033
00034 set<GameObject*> deleteList;
00035 vector<GameObject*> addList;
00036
00037 bool inDebug;
00038 GameObject* debugCamera;
00039 Camera* cam;
00040 Camera* mainCamera;
00041
00042 public:
00043 ~TREngine(void);
00044 static TREngine* getInstance(){
00045 if(!instance)
00046 instance = new TREngine();
00047 return instance;
00048 };
00049
00050 const CollisionHandler* getCollisionHandler(){return collisionHandler;}
00051
00052 void initialize(Scene* scene, vector<Behaviour*>* updateQueue, CollisionHandler* collisionHandler){
00053 this->scene = scene;
00054 this->updateQueue = updateQueue;
00055 this->collisionHandler = collisionHandler;
00056 }
00057
00058 void shutDown();
00059
00060 void setDebugMode(bool enable);
00061 bool inDebugMode(){return inDebug;}
00062
00063 bool rayCast(const Ray& ray, RayCastHit& hit, Collider* ignore = NULL)const;
00064
00065 void addGameObject(GameObject* gameObject);
00066 void deleteGameObject(GameObject* gameObject);
00067
00068 vector<GameObject*>* getObjectList(){
00069 return &objects;
00070 }
00071
00072 void endFrame();
00073 };
00074
00075 #endif
00076