src/Engine.hh
author terom
Mon, 08 Dec 2008 12:46:37 +0000
changeset 283 7540b0859579
parent 233 ff4ecea83cf5
child 389 e74c1820fbd2
permissions -rw-r--r--
start adding some documentation, most core classes (outside of Network) are now doxygen-enabled
#ifndef ENGINE_HH
#define ENGINE_HH

// forward-declare
class Engine;

#include "GameState.hh"
#include "Graphics.hh"
#include "Network/Server.hh"
#include "Network/Client.hh"

#include "Logger.hh"

/**
 * This is the core class that glues all the other components together and runs the main loop
 */
class Engine {
    private:
        // game state
        GameState game_state;
        
        // Graphics/Input
        Graphics *graphics;

        // network server/client
        NetworkServer *net_server;
        NetworkClient *net_client;

        // to exit the mainloop
        bool is_running;

        // ClanLib resources
        CL_ResourceManager resources;
    
    public:    
        // default constructor
        Engine (const std::string resource_xml_path = RESOURCE_XML_PATH);

        // setup graphics
        void setupGraphics (void);
        
        // set up network server/client
        // setting up both of these will lead to odd behaviour :)
        void setupNetworkServer (const std::string &listen_port);
        void setupNetworkClient (const std::string &connect_host, const std::string &connect_port);
		void setupSinglePlayer (void);
        
        // run the main loop
        void run (void);

        // terminate the main loop
        void stop (void);

    public:
        // get a pointer to our resource manager
        CL_ResourceManager* getResourceManager (void);

        // logging utility
        static Logger log (enum LogLevel level, const char *type);

};

#endif /* ENGINE_HH */