src/proto2/Engine.hh
author saiam
Fri, 28 Nov 2008 22:26:23 +0000
changeset 128 890ac82cdcc0
parent 58 a53f5ad69500
permissions -rw-r--r--
Documenting more, cleaning variables. This code needs some serious
rewriting. (And we havent too many features either)
#ifndef ENGINE_HH
#define ENGINE_HH

// XXX: forward-declare Engine for other components
class Engine;

#include "GameState.hh"
#include "Graphics.hh"
#include "NetworkServer.hh"
#include "NetworkClient.hh"

#include "Logger.hh"

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;
    
    public:    
        // default constructor
        Engine (void);

        // 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:
        // logging utility
        static Logger log (enum LogLevel level, const char *type);

};

#endif /* ENGINE_HH */