src/Engine.hh
branchnew_graphics
changeset 418 194bc810a570
parent 417 c503e0c6a740
child 419 9cd4e54693b6
--- a/src/Engine.hh	Thu Jan 22 01:53:05 2009 +0200
+++ b/src/Engine.hh	Thu Jan 22 02:38:33 2009 +0200
@@ -20,27 +20,36 @@
  */
 class Engine {
     private:
-        // game state
+        /** The game's terrain */
         Terrain *terrain;
-        GameState *game_state;
-
-        // Graphics/Input
-        graphics::Graphics *graphics;
 
-        // network server/client
+        /** The game's state */
+        GameState *game_state;
+        
+        /** The graphics+input component */
+        graphics::Graphics *graphics;
+        
+        /** Network server */
         NetworkServer *net_server;
-        NetworkClientConnect *net_client_connect;
-        // XXX: currently unused: NetworkClient *net_client;
 
-        // to exit the mainloop
+        /** Network client connector */
+        NetworkClientConnect *net_client_connect;
+
+        /** Network client, currently unused */
+        NetworkClient *net_client;
+
+        /** Is the mainloop still running? */
         bool is_running;
+        
+        /** Used to load ClanLib resources */
+        CL_ResourceManager resources;
 
-        // ClanLib resources
-        CL_ResourceManager resources;
+        /** *Global* log level */
+        static LogLevel log_level;
     
     public:    
         // default constructor
-        Engine (const std::string resource_xml_path = RESOURCE_XML_PATH);
+        Engine (const EngineConfig &config);
 
         /**
          * Setup game world using the given terrain, returning the new GameState
@@ -97,11 +106,21 @@
         void startGameView (LocalPlayer *player);
 
     public:
-        // get a pointer to our resource manager
-        CL_ResourceManager* getResourceManager (void);
-
-        // logging utility
-        static Logger log (enum LogLevel level, const char *type);
+        /**
+         * Get a pointer to our resource manager, please don't break it.
+         *
+         * Guaranteed to never be NULL
+         */
+        CL_ResourceManager* getResourceManager (void) { return &resources; }
+        
+        /**
+         * Log output, see Logger for more info
+         *
+         * @see Logger
+         */
+        static inline Logger log (LogLevel level, const char *type) {
+            return Logger(level <= WARN ? std::cerr : std::cout, level, type, log_level);
+        }
 
 };