-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.h
47 lines (36 loc) · 930 Bytes
/
core.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef CORE_H
#define CORE_H
#include <QObject>
#include "network.h"
#include "protocol.h"
#include "abstract_ai.h"
#include "helpers/messages.h"
#include "helpers/blockingconcurrentqueue.h"
namespace koala { namespace chillin { namespace client {
class Core : public QObject
{
Q_OBJECT
public:
Core(QObject *parent = 0);
~Core();
void registerAI(AbstractAI *ai);
bool connectToServer();
bool joinGame();
void loop();
private:
void handleSnapshot(const ParsedMessage *msg);
void handleStartGame(const ParsedMessage *msg);
void handleEndGame(const ParsedMessage *msg);
private:
void sendMessage(const ks::KSObject *msg);
void sendCommandThread();
void quit();
private:
bool gameRunning;
Network *network;
Protocol *protocol;
AbstractAI *ai;
moodycamel::BlockingConcurrentQueue<ks::messages::BaseCommand*> commandSendQueue;
};
}}}
#endif // CORE_H