00001 /* 00002 * engine.h 00003 * 00004 * Created on: November 20, 2011 00005 * Author: sushil j louis 00006 */ 00007 00008 #ifndef ENGINE_H_ 00009 #define ENGINE_H_ 00010 00011 #include <options.h> 00012 #include <entityMgr.h> 00013 #include <selectionMgr.h> 00014 #include <weaponMgr.h> 00015 #include <gameMgr.h> 00016 #include <distanceMgr.h> 00017 00018 #include <groupMgr.h> 00019 00020 00021 #include <gfxThread.h> 00022 #include <netThread.h> 00023 #include <timer.h> 00024 00025 //#include<params.h> 00026 00027 namespace FastEcslent { 00028 00029 enum GameState{ 00030 LOBBY = 0, 00031 GAME = 1, 00032 00033 NGAMESTATES 00034 }; 00035 00036 class Engine { 00037 00038 private: 00039 void tickAll(float dt); 00040 00041 //test vars/methods 00042 FastEcslent::MilliSecondTimer* selectionTimer; 00043 FastEcslent::MilliSecondTimer* distanceTimer; 00044 void runTests(); 00045 00046 //Main thread sleep while waiting for lobby setting 00047 boost::posix_time::milliseconds *sleepInterval; 00048 00049 public: 00050 00051 Options options; 00052 int instanceId; 00053 //Params flockParameters; 00054 int rands[1000]; 00055 00056 bool quit; 00057 00058 //State, indicate if game is in lobby state. Could be changed by remote end. 00059 volatile GameState gameState; 00060 00061 boost::mutex quitLock; 00062 00063 EntityMgr* entityMgr; 00064 SelectionMgr* selectionMgr; 00065 WeaponMgr* weaponMgr; 00066 GameMgr* gameMgr; 00067 DistanceMgr* distanceMgr; 00068 GroupMgr* groupMgr; 00069 00070 00071 //threads. optional Features 00072 00073 NetThread *net; 00074 GfxThread *gfx; 00075 00076 Engine(int instId, Options opts) { 00077 instanceId = instId; 00078 options = opts; 00079 quit = false; 00080 this->gameState = GAME; 00081 } 00082 00083 ~Engine(){ 00084 delete selectionMgr; 00085 delete distanceMgr; 00086 delete gameMgr; 00087 delete groupMgr; 00088 delete entityMgr; 00089 } 00090 //Managers 00091 void showMenu(); 00092 void constructManagers(); 00093 void init(); 00094 void loadLevel(); 00095 void releaseLevel(); 00096 void run(); 00097 void stop(); 00098 00099 } ; 00100 00101 typedef Engine * EnginePtr; 00102 } 00103 00104 00105 00106 #endif /* ENGINE_H_ */