--- a/src/Engine.hh Tue Jan 20 23:24:04 2009 +0200
+++ b/src/Engine.hh Tue Jan 20 23:30:18 2009 +0200
@@ -17,14 +17,19 @@
class Engine {
private:
// game state
- GameState game_state;
+ Terrain *terrain;
+ GameState *game_state;
+
+ /** Set if setupGraphics has been called */
+ const GraphicsConfiguration *graphics_config;
// Graphics/Input
Graphics *graphics;
// network server/client
NetworkServer *net_server;
- NetworkClient *net_client;
+ NetworkClientConnect *net_client_connect;
+ // XXX: currently unused: NetworkClient *net_client;
// to exit the mainloop
bool is_running;
@@ -36,8 +41,18 @@
// default constructor
Engine (const std::string resource_xml_path = RESOURCE_XML_PATH);
+ /**
+ * Setup game world using the given terrain, returning the new GameState
+ */
+ GameState& setupGame (Terrain *terrain);
+
+ /**
+ * Setup default game world using constants from Config.hh
+ */
+ GameState& setupGame (void);
+
// setup graphics
- void setupGraphics (PixelCoordinate resolution, bool fullscreen);
+ void setupGraphics (const GraphicsConfiguration &config);
// set up network server/client
// setting up both of these will lead to odd behaviour :)
@@ -45,11 +60,21 @@
void setupNetworkClient (const std::string &connect_host, const std::string &connect_port);
void setupSinglePlayer (void);
- // run the main loop
+ /**
+ * Run the game main loop. This will not return until the game aborts due to an error, or someone calls stop().
+ */
void run (void);
+
+ /**
+ * Terminate the main loop, causing run() to return once this loop iteration is finished
+ */
+ void stop (void);
- // terminate the main loop
- void stop (void);
+ private:
+ /**
+ * Actually start graphics, requires that game_state is now set
+ */
+ void startGraphics (void);
public:
// get a pointer to our resource manager