00001 00002 00003 #ifndef COREENGINE_H 00004 #define COREENGINE_H 00005 00006 00007 #include "glew.h" 00008 00009 #include "InputSystem.h" 00010 00011 #include <string> 00012 00013 00014 namespace pge { 00015 00016 00017 class GLApplication; 00018 class World; 00019 00020 00021 class CoreEngine { 00022 public: 00023 //************************************************************************ 00024 // 00025 // Destructor 00026 // 00027 //************************************************************************ 00029 virtual ~CoreEngine(void); 00030 00031 00032 //************************************************************************ 00033 // 00034 // Functions 00035 // 00036 //************************************************************************ 00037 static CoreEngine* getInstance(void); 00038 void init(GLApplication *owner, int resX, int resY); 00039 00040 bool init(void); 00041 void render(void); 00042 void reshape(GLsizei width, GLsizei height); 00043 void shutdown(void); 00044 void mainLoop(void); 00045 void action(InputSystem::InputAction type, int param0, int param1); 00046 int getResolutionWidth(void); 00047 int getResolutionHeight(void); 00048 00049 int getFPS(void); 00050 00051 void setCurrentWorld(World *world); 00052 World* getCurrentWorld(void); 00053 bool hasActiveWorld(void); 00054 00055 00056 private: 00057 //************************************************************************ 00058 // 00059 // Constructor 00060 // 00061 //************************************************************************ 00062 CoreEngine(void); 00063 00064 00065 //************************************************************************ 00066 // 00067 // Functions 00068 // 00069 //************************************************************************ 00070 void timer(unsigned int delay); 00071 00072 00073 //************************************************************************ 00074 // 00075 // Variables 00076 // 00077 //************************************************************************ 00079 GLApplication *m_owner; 00080 00081 // Screen Resolution. 00082 int m_resX; 00083 int m_resY; 00084 00085 // Timer. 00086 unsigned int m_delay; 00087 unsigned int m_lastTime; 00088 00089 // Run variables. 00090 bool m_engineRunning; 00091 00092 // Init. 00093 bool m_initDone; 00094 00095 // Fps 00096 int m_fps; 00097 unsigned int m_fpsLoop; 00098 int m_fpsResult; 00099 00100 // World. 00101 World *m_currentWorld; 00102 }; 00103 }; 00104 00105 #endif