author | saiam |
Fri, 28 Nov 2008 22:26:23 +0000 | |
changeset 128 | 890ac82cdcc0 |
parent 58 | a53f5ad69500 |
permissions | -rw-r--r-- |
25 | 1 |
#ifndef ENGINE_HH |
2 |
#define ENGINE_HH |
|
21 | 3 |
|
25 | 4 |
// XXX: forward-declare Engine for other components |
5 |
class Engine; |
|
6 |
||
7 |
#include "GameState.hh" |
|
8 |
#include "Graphics.hh" |
|
21 | 9 |
#include "NetworkServer.hh" |
10 |
#include "NetworkClient.hh" |
|
11 |
||
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
22
diff
changeset
|
12 |
#include "Logger.hh" |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
22
diff
changeset
|
13 |
|
21 | 14 |
class Engine { |
24 | 15 |
private: |
16 |
// game state |
|
17 |
GameState game_state; |
|
18 |
||
25 | 19 |
// Graphics/Input |
20 |
Graphics *graphics; |
|
21 |
||
24 | 22 |
// network server/client |
23 |
NetworkServer *net_server; |
|
24 |
NetworkClient *net_client; |
|
21 | 25 |
|
24 | 26 |
// to exit the mainloop |
27 |
bool is_running; |
|
25 | 28 |
|
29 |
public: |
|
24 | 30 |
// default constructor |
31 |
Engine (void); |
|
21 | 32 |
|
25 | 33 |
// setup graphics |
34 |
void setupGraphics (void); |
|
24 | 35 |
|
25 | 36 |
// set up network server/client |
37 |
// setting up both of these will lead to odd behaviour :) |
|
38 |
void setupNetworkServer (const std::string &listen_port); |
|
39 |
void setupNetworkClient (const std::string &connect_host, const std::string &connect_port); |
|
58 | 40 |
void setupSinglePlayer (void); |
25 | 41 |
|
42 |
// run the main loop |
|
43 |
void run (void); |
|
44 |
||
45 |
// terminate the main loop |
|
46 |
void stop (void); |
|
47 |
||
48 |
public: |
|
49 |
// logging utility |
|
24 | 50 |
static Logger log (enum LogLevel level, const char *type); |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
51 |
|
21 | 52 |
}; |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
22
diff
changeset
|
53 |
|
25 | 54 |
#endif /* ENGINE_HH */ |