author | unC0Rr |
Fri, 07 Dec 2018 13:56:45 +0100 | |
changeset 14372 | b6824a53d4b1 |
parent 14371 | 90bd2c331703 |
child 15891 | d52f5d8e75e6 |
permissions | -rw-r--r-- |
14143 | 1 |
#ifndef HWENGINE_H |
2 |
#define HWENGINE_H |
|
3 |
||
4 |
#include <QList> |
|
5 |
#include <QObject> |
|
6 |
||
14154
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
14143
diff
changeset
|
7 |
#include "engine_interface.h" |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
14143
diff
changeset
|
8 |
#include "game_config.h" |
14143 | 9 |
|
10 |
class QQmlEngine; |
|
14298 | 11 |
class EngineInstance; |
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
12 |
class PreviewAcceptor; |
14143 | 13 |
|
14 |
class HWEngine : public QObject { |
|
15 |
Q_OBJECT |
|
16 |
||
17 |
Q_PROPERTY(int previewHedgehogsCount READ previewHedgehogsCount NOTIFY |
|
18 |
previewHedgehogsCountChanged) |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
19 |
Q_PROPERTY(PreviewAcceptor* previewAcceptor READ previewAcceptor WRITE |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
20 |
setPreviewAcceptor NOTIFY previewAcceptorChanged) |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
21 |
Q_PROPERTY(QString engineLibrary READ engineLibrary WRITE setEngineLibrary |
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
22 |
NOTIFY engineLibraryChanged) |
14143 | 23 |
|
24 |
public: |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
25 |
explicit HWEngine(QObject* parent = nullptr); |
14143 | 26 |
~HWEngine(); |
27 |
||
28 |
Q_INVOKABLE void getPreview(); |
|
14298 | 29 |
Q_INVOKABLE EngineInstance* runQuickGame(); |
14143 | 30 |
|
31 |
int previewHedgehogsCount() const; |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
32 |
PreviewAcceptor* previewAcceptor() const; |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
33 |
QString engineLibrary() const; |
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
34 |
|
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
35 |
public slots: |
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
36 |
void setPreviewAcceptor(PreviewAcceptor* previewAcceptor); |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
37 |
void setEngineLibrary(const QString& engineLibrary); |
14143 | 38 |
|
39 |
signals: |
|
40 |
void previewIsRendering(); |
|
41 |
void previewImageChanged(); |
|
42 |
void previewHogCountChanged(int count); |
|
43 |
void gameFinished(); |
|
44 |
void previewHedgehogsCountChanged(int previewHedgehogsCount); |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
45 |
void previewAcceptorChanged(PreviewAcceptor* previewAcceptor); |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
46 |
void engineLibraryChanged(const QString& engineLibrary); |
14143 | 47 |
|
48 |
private: |
|
49 |
QQmlEngine* m_engine; |
|
50 |
GameConfig m_gameConfig; |
|
51 |
int m_previewHedgehogsCount; |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
52 |
PreviewAcceptor* m_previewAcceptor; |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
53 |
QString m_engineLibrary; |
14143 | 54 |
}; |
55 |
||
56 |
#endif // HWENGINE_H |