terom@185: #ifndef ENGINE_HH terom@185: #define ENGINE_HH terom@185: terom@218: // forward-declare terom@185: class Engine; terom@185: terom@185: #include "GameState.hh" terom@185: #include "Graphics.hh" terom@186: #include "Network/Server.hh" terom@186: #include "Network/Client.hh" terom@185: terom@185: #include "Logger.hh" terom@185: terom@283: /** terom@283: * This is the core class that glues all the other components together and runs the main loop terom@283: */ terom@185: class Engine { terom@185: private: terom@185: // game state terom@185: GameState game_state; terom@185: terom@185: // Graphics/Input terom@185: Graphics *graphics; terom@185: terom@185: // network server/client terom@185: NetworkServer *net_server; terom@185: NetworkClient *net_client; terom@185: terom@185: // to exit the mainloop terom@185: bool is_running; terom@218: terom@233: // ClanLib resources terom@233: CL_ResourceManager resources; terom@185: terom@185: public: terom@185: // default constructor terom@233: Engine (const std::string resource_xml_path = RESOURCE_XML_PATH); terom@185: terom@185: // setup graphics terom@185: void setupGraphics (void); terom@185: terom@185: // set up network server/client terom@185: // setting up both of these will lead to odd behaviour :) terom@185: void setupNetworkServer (const std::string &listen_port); terom@185: void setupNetworkClient (const std::string &connect_host, const std::string &connect_port); terom@185: void setupSinglePlayer (void); terom@185: terom@185: // run the main loop terom@185: void run (void); terom@185: terom@185: // terminate the main loop terom@185: void stop (void); terom@185: terom@185: public: terom@233: // get a pointer to our resource manager terom@233: CL_ResourceManager* getResourceManager (void); terom@218: terom@185: // logging utility terom@185: static Logger log (enum LogLevel level, const char *type); terom@185: terom@185: }; terom@185: terom@185: #endif /* ENGINE_HH */