00001 #ifndef ENGINE_H
00002 #define ENGINE_H
00003
00004
00005 #include "../UI/EventHandler.h"
00006 #include "Camera.h"
00007 #include "../Physics/Physics.h"
00008 #include <GL/gl.h>
00009 #include <GL/glu.h>
00010 #include <GL/glut.h>
00011 #include "INotifiable.h"
00012 #include "IObservable.h"
00013 #include "GameState.h"
00014 #include "TextureManager.h"
00015 #include "GameLogic.h"
00016 #include <iostream>
00017
00018
00019 const float DEF_WIDTH=800.0;
00020 const float DEF_HEIGHT=600.0;
00021
00022 class Engine: public INotifiable
00023 {
00024 public:
00025 struct WindowSuggestions
00026 {
00027 static const int WIDTH =800;
00028 static const int HEIGHT =600;
00029 static const int POSX = 100;
00030 static const int POSY = 100;
00031 static const char* windowName;
00032 };
00033
00034 private:
00035 GameState *state;
00036 TextureManager *textMan;
00037 GameLogic *logic;
00038 Physics * physics;
00039 Scene *scene;
00040 EventHandler *eventHandler;
00041 Camera *camera;
00042 Timer physicsTimer;
00043 Timer renderTimer;
00044
00045 double elapsedTime;
00046 int frames;
00047 bool showFPS;
00048
00049
00050
00051
00052 void FPS();
00053
00054
00055 public:
00056
00057 Engine();
00058
00059 void display();
00060 void idle();
00061 void init();
00062 void resize(int Width, int Height);
00063 void handleKeyboardEvent(unsigned char key, int x, int y);
00064 void handleMouseEvent(int button, int state,int x, int y);
00065 void run();
00066 void processNotification(ISubject *s);
00067
00068 Physics* getPhysics() { return physics;}
00069 Camera* getCamera() {return camera;}
00070 Scene* getScene(){ return scene;}
00071 GameState* getState(){ return state;}
00072
00073
00074 };
00075
00076 #endif