14164
|
1 |
#ifndef HWENGINE_H
|
|
2 |
#define HWENGINE_H
|
|
3 |
|
|
4 |
#include <QList>
|
|
5 |
#include <QObject>
|
|
6 |
|
|
7 |
#include "flib.h"
|
|
8 |
#include "gameconfig.h"
|
|
9 |
|
|
10 |
class QQmlEngine;
|
|
11 |
class PreviewImageProvider;
|
|
12 |
class RunQueue;
|
|
13 |
|
|
14 |
class HWEngine : public QObject {
|
|
15 |
Q_OBJECT
|
|
16 |
|
|
17 |
Q_PROPERTY(int previewHedgehogsCount READ previewHedgehogsCount NOTIFY
|
|
18 |
previewHedgehogsCountChanged)
|
|
19 |
|
|
20 |
public:
|
|
21 |
explicit HWEngine(QQmlEngine* engine, QObject* parent = nullptr);
|
|
22 |
~HWEngine();
|
|
23 |
|
|
24 |
static void exposeToQML();
|
|
25 |
|
|
26 |
Q_INVOKABLE void getPreview();
|
|
27 |
Q_INVOKABLE void runQuickGame();
|
|
28 |
|
|
29 |
int previewHedgehogsCount() const;
|
|
30 |
|
|
31 |
signals:
|
|
32 |
void previewIsRendering();
|
|
33 |
void previewImageChanged();
|
|
34 |
void previewHogCountChanged(int count);
|
|
35 |
void gameFinished();
|
|
36 |
void previewHedgehogsCountChanged(int previewHedgehogsCount);
|
|
37 |
|
|
38 |
private:
|
|
39 |
QQmlEngine* m_engine;
|
|
40 |
PreviewImageProvider* m_previewProvider;
|
|
41 |
RunQueue* m_runQueue;
|
|
42 |
GameConfig m_gameConfig;
|
|
43 |
QByteArray m_seed;
|
|
44 |
int m_previewHedgehogsCount;
|
|
45 |
|
|
46 |
static void guiMessagesCallback(void* context, MessageType mt,
|
|
47 |
const char* msg, uint32_t len);
|
|
48 |
|
|
49 |
private slots:
|
|
50 |
void engineMessageHandler(MessageType mt, const QByteArray& msg);
|
|
51 |
};
|
|
52 |
|
|
53 |
#endif // HWENGINE_H
|