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 00078 ~Engine(); 00079 //Managers 00080 void showMenu(); 00081 void constructManagers(); 00082 void init(); 00083 void loadLevel(); 00084 void releaseLevel(); 00085 void run(); 00086 void stop(); 00087 00088 } ; 00089 00090 typedef Engine * EnginePtr; 00091 } 00092 00093 00094 00095 #endif /* ENGINE_H_ */