18 /** |
18 /** |
19 * This is the core class that glues all the other components together and runs the main loop |
19 * This is the core class that glues all the other components together and runs the main loop |
20 */ |
20 */ |
21 class Engine { |
21 class Engine { |
22 private: |
22 private: |
23 // game state |
23 /** The game's terrain */ |
24 Terrain *terrain; |
24 Terrain *terrain; |
|
25 |
|
26 /** The game's state */ |
25 GameState *game_state; |
27 GameState *game_state; |
|
28 |
|
29 /** The graphics+input component */ |
|
30 graphics::Graphics *graphics; |
|
31 |
|
32 /** Network server */ |
|
33 NetworkServer *net_server; |
26 |
34 |
27 // Graphics/Input |
35 /** Network client connector */ |
28 graphics::Graphics *graphics; |
36 NetworkClientConnect *net_client_connect; |
29 |
37 |
30 // network server/client |
38 /** Network client, currently unused */ |
31 NetworkServer *net_server; |
39 NetworkClient *net_client; |
32 NetworkClientConnect *net_client_connect; |
|
33 // XXX: currently unused: NetworkClient *net_client; |
|
34 |
40 |
35 // to exit the mainloop |
41 /** Is the mainloop still running? */ |
36 bool is_running; |
42 bool is_running; |
|
43 |
|
44 /** Used to load ClanLib resources */ |
|
45 CL_ResourceManager resources; |
37 |
46 |
38 // ClanLib resources |
47 /** *Global* log level */ |
39 CL_ResourceManager resources; |
48 static LogLevel log_level; |
40 |
49 |
41 public: |
50 public: |
42 // default constructor |
51 // default constructor |
43 Engine (const std::string resource_xml_path = RESOURCE_XML_PATH); |
52 Engine (const EngineConfig &config); |
44 |
53 |
45 /** |
54 /** |
46 * Setup game world using the given terrain, returning the new GameState |
55 * Setup game world using the given terrain, returning the new GameState |
47 * |
56 * |
48 * XXX: fix to return void |
57 * XXX: fix to return void |
95 * Puts graphics into GameView mode, using our GameState and the given player |
104 * Puts graphics into GameView mode, using our GameState and the given player |
96 */ |
105 */ |
97 void startGameView (LocalPlayer *player); |
106 void startGameView (LocalPlayer *player); |
98 |
107 |
99 public: |
108 public: |
100 // get a pointer to our resource manager |
109 /** |
101 CL_ResourceManager* getResourceManager (void); |
110 * Get a pointer to our resource manager, please don't break it. |
102 |
111 * |
103 // logging utility |
112 * Guaranteed to never be NULL |
104 static Logger log (enum LogLevel level, const char *type); |
113 */ |
|
114 CL_ResourceManager* getResourceManager (void) { return &resources; } |
|
115 |
|
116 /** |
|
117 * Log output, see Logger for more info |
|
118 * |
|
119 * @see Logger |
|
120 */ |
|
121 static inline Logger log (LogLevel level, const char *type) { |
|
122 return Logger(level <= WARN ? std::cerr : std::cout, level, type, log_level); |
|
123 } |
105 |
124 |
106 }; |
125 }; |
107 |
126 |
108 #endif /* ENGINE_HH */ |
127 #endif /* ENGINE_HH */ |