6 |
6 |
7 #include "engine_interface.h" |
7 #include "engine_interface.h" |
8 #include "game_config.h" |
8 #include "game_config.h" |
9 |
9 |
10 class QQmlEngine; |
10 class QQmlEngine; |
11 class PreviewImageProvider; |
|
12 class EngineInstance; |
11 class EngineInstance; |
|
12 class PreviewAcceptor; |
13 |
13 |
14 class HWEngine : public QObject { |
14 class HWEngine : public QObject { |
15 Q_OBJECT |
15 Q_OBJECT |
16 |
16 |
17 Q_PROPERTY(int previewHedgehogsCount READ previewHedgehogsCount NOTIFY |
17 Q_PROPERTY(int previewHedgehogsCount READ previewHedgehogsCount NOTIFY |
18 previewHedgehogsCountChanged) |
18 previewHedgehogsCountChanged) |
|
19 Q_PROPERTY(PreviewAcceptor* previewAcceptor READ previewAcceptor WRITE |
|
20 setPreviewAcceptor NOTIFY previewAcceptorChanged) |
19 |
21 |
20 public: |
22 public: |
21 explicit HWEngine(QQmlEngine* engine, QObject* parent = nullptr); |
23 explicit HWEngine(QObject* parent = nullptr); |
22 ~HWEngine(); |
24 ~HWEngine(); |
23 |
|
24 static void exposeToQML(); |
|
25 |
25 |
26 Q_INVOKABLE void getPreview(); |
26 Q_INVOKABLE void getPreview(); |
27 Q_INVOKABLE EngineInstance* runQuickGame(); |
27 Q_INVOKABLE EngineInstance* runQuickGame(); |
28 |
28 |
29 int previewHedgehogsCount() const; |
29 int previewHedgehogsCount() const; |
|
30 PreviewAcceptor* previewAcceptor() const; |
|
31 |
|
32 public slots: |
|
33 void setPreviewAcceptor(PreviewAcceptor* previewAcceptor); |
30 |
34 |
31 signals: |
35 signals: |
32 void previewIsRendering(); |
36 void previewIsRendering(); |
33 void previewImageChanged(); |
37 void previewImageChanged(); |
34 void previewHogCountChanged(int count); |
38 void previewHogCountChanged(int count); |
35 void gameFinished(); |
39 void gameFinished(); |
36 void previewHedgehogsCountChanged(int previewHedgehogsCount); |
40 void previewHedgehogsCountChanged(int previewHedgehogsCount); |
|
41 void previewAcceptorChanged(PreviewAcceptor* previewAcceptor); |
37 |
42 |
38 private: |
43 private: |
39 QQmlEngine* m_engine; |
44 QQmlEngine* m_engine; |
40 PreviewImageProvider* m_previewProvider; |
|
41 GameConfig m_gameConfig; |
45 GameConfig m_gameConfig; |
42 int m_previewHedgehogsCount; |
46 int m_previewHedgehogsCount; |
|
47 PreviewAcceptor* m_previewAcceptor; |
43 }; |
48 }; |
44 |
49 |
45 #endif // HWENGINE_H |
50 #endif // HWENGINE_H |