equal
deleted
inserted
replaced
8 #include "Configuration.hh" |
8 #include "Configuration.hh" |
9 #include "Logger.hh" |
9 #include "Logger.hh" |
10 |
10 |
11 // forward-declare component pointer types |
11 // forward-declare component pointer types |
12 // XXX: move to some kind of Components.hh file? |
12 // XXX: move to some kind of Components.hh file? |
13 namespace graphics { class Graphics; } |
13 namespace graphics { class Graphics; class GameView; } |
14 class NetworkServer; |
14 class NetworkServer; |
15 class NetworkClientConnect; |
15 class NetworkClientConnect; |
16 class NetworkClient; |
16 class NetworkClient; |
|
17 class NetworkClientController; |
17 |
18 |
18 /** |
19 /** |
19 * This is the core class that glues all the other components together and runs the main loop |
20 * This is the core class that glues all the other components together and runs the main loop |
20 */ |
21 */ |
21 class Engine { |
22 class Engine { |
36 NetworkClientConnect *net_client_connect; |
37 NetworkClientConnect *net_client_connect; |
37 |
38 |
38 /** Network client, currently unused */ |
39 /** Network client, currently unused */ |
39 NetworkClient *net_client; |
40 NetworkClient *net_client; |
40 |
41 |
|
42 /** The GameView, if open */ |
|
43 graphics::GameView *game_view; |
|
44 |
41 /** Is the mainloop still running? */ |
45 /** Is the mainloop still running? */ |
42 bool is_running; |
46 bool is_running; |
43 |
47 |
44 /** Used to load ClanLib resources */ |
48 /** Used to load ClanLib resources */ |
45 CL_ResourceManager resources; |
49 CL_ResourceManager resources; |
51 // default constructor |
55 // default constructor |
52 Engine (const EngineConfig &config); |
56 Engine (const EngineConfig &config); |
53 |
57 |
54 /** |
58 /** |
55 * Setup game world using the given terrain, returning the new GameState |
59 * Setup game world using the given terrain, returning the new GameState |
56 * |
|
57 * XXX: fix to return void |
|
58 */ |
60 */ |
59 GameState& setupGame (Terrain *terrain); |
61 void setupGame (Terrain *terrain); |
60 |
62 |
61 /** |
63 /** |
62 * Setup game world using given terrain configuration |
64 * Setup game world using given terrain configuration |
63 */ |
65 */ |
64 void setupGame (const TerrainConfig &config); |
66 void setupGame (const TerrainConfig &config); |
103 /** |
105 /** |
104 * Puts graphics into GameView mode, using our GameState and the given player |
106 * Puts graphics into GameView mode, using our GameState and the given player |
105 */ |
107 */ |
106 void startGameView (LocalPlayer *player); |
108 void startGameView (LocalPlayer *player); |
107 |
109 |
|
110 protected: |
|
111 friend class NetworkClientConnect; |
|
112 friend class NetworkClientController; |
|
113 |
|
114 /** |
|
115 * Interface for NetworkClient to use once it has connected |
|
116 */ |
|
117 GameState& onNetworkClientConnected (Terrain *terrain); |
|
118 |
|
119 /** |
|
120 * Interface for NetworkClient to use once it has set up the player |
|
121 */ |
|
122 void onNetworkClientPlayer (LocalPlayer *player); |
|
123 |
108 public: |
124 public: |
109 /** |
125 /** |
110 * Get a pointer to our resource manager, please don't break it. |
126 * Get a pointer to our resource manager, please don't break it. |
111 * |
127 * |
112 * Guaranteed to never be NULL |
128 * Guaranteed to never be NULL |