game.h

Go to the documentation of this file.
00001 /* MAINTAINER: Bernard CURRENT_EDITOR: Bernard */ 
00002 
00003 #ifndef _GAME_H
00004 #define _GAME_H
00005 
00006 #include <string>
00007 #include <vector>
00008 #include "world.h"
00009 #include "taskmanager.h"
00010 #include "player.h"
00011 #include "mutex.h"
00012 #include "eventqueue.h"
00013 
00021 class Game 
00022 {
00023 public:
00024         Game(void);
00025         virtual ~Game(void);
00026         
00035         virtual bool loadMap(const std::string mapName);
00036 
00043         virtual void init() = 0;
00044         
00050         virtual void run() = 0;
00051     
00059         virtual void clean();
00060         
00064         virtual void endFun();
00065         
00071         World& getWorld();
00072 
00073 
00087         int newPlayer(const Player &player, int ID = -1);
00088 
00089         
00097         Player & getPlayer(int ID);
00098 
00099         
00111         void removePlayer(int ID);
00112         
00113 
00122         std::vector<int>& getValidPlayersID();
00123         
00133         bool isPlayerIDValid(int ID);
00134 
00135         
00144         bool isRunning();
00145 
00152         TaskManager& getTaskManager();
00153 
00158         EventQueue & getEventQueue()
00159         {
00160                 return mEventQueue;
00161         }
00162         
00163 protected:
00164 
00168         EventQueue      mEventQueue;    
00169 
00170 
00176         void recreateWorld();
00177         
00184         void setRunning(bool state);
00185 
00186         bool  mRunning; 
00187         Mutex mRunningMutex; 
00188         
00189         
00190         
00191         World           *mWorld;         
00192 
00193         TaskManager     mTaskManager;   
00194 
00195         bool            mEndFun;                
00196 
00202         std::vector<Player*> mPlayers; 
00203         std::vector<int> mValidPlayersID; 
00204 
00210         void updateValidPlayersID();
00211 };
00212 
00213 #endif // _GAME_H

Generated on Wed Apr 12 13:55:28 2006 for bjs by  doxygen 1.4.5