author | nemo |
Sun, 24 Mar 2024 14:33:57 -0400 | |
changeset 16024 | 4c523ed1d35c |
parent 15919 | d52f5d8e75e6 |
child 16039 | a73b9770467a |
permissions | -rw-r--r-- |
14164 | 1 |
#ifndef HWENGINE_H |
2 |
#define HWENGINE_H |
|
3 |
||
4 |
#include <QList> |
|
5 |
#include <QObject> |
|
6 |
||
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
14164
diff
changeset
|
7 |
#include "engine_interface.h" |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
14164
diff
changeset
|
8 |
#include "game_config.h" |
14164 | 9 |
|
10 |
class QQmlEngine; |
|
14319 | 11 |
class EngineInstance; |
14392
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14319
diff
changeset
|
12 |
class PreviewAcceptor; |
14164 | 13 |
|
14 |
class HWEngine : public QObject { |
|
15 |
Q_OBJECT |
|
16 |
||
17 |
Q_PROPERTY(int previewHedgehogsCount READ previewHedgehogsCount NOTIFY |
|
18 |
previewHedgehogsCountChanged) |
|
14392
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14319
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:
14319
diff
changeset
|
20 |
setPreviewAcceptor NOTIFY previewAcceptorChanged) |
14393
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14392
diff
changeset
|
21 |
Q_PROPERTY(QString engineLibrary READ engineLibrary WRITE setEngineLibrary |
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14392
diff
changeset
|
22 |
NOTIFY engineLibraryChanged) |
15919 | 23 |
Q_PROPERTY(QString dataPath READ dataPath WRITE setDataPath NOTIFY dataPathChanged) |
14164 | 24 |
|
25 |
public: |
|
14392
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14319
diff
changeset
|
26 |
explicit HWEngine(QObject* parent = nullptr); |
14164 | 27 |
~HWEngine(); |
28 |
||
29 |
Q_INVOKABLE void getPreview(); |
|
14319 | 30 |
Q_INVOKABLE EngineInstance* runQuickGame(); |
14164 | 31 |
|
32 |
int previewHedgehogsCount() const; |
|
14392
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14319
diff
changeset
|
33 |
PreviewAcceptor* previewAcceptor() const; |
14393
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14392
diff
changeset
|
34 |
QString engineLibrary() const; |
14392
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14319
diff
changeset
|
35 |
|
15919 | 36 |
const QString &dataPath() const; |
37 |
void setDataPath(const QString &newDataPath); |
|
38 |
||
39 |
public slots: |
|
14392
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14319
diff
changeset
|
40 |
void setPreviewAcceptor(PreviewAcceptor* previewAcceptor); |
14393
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14392
diff
changeset
|
41 |
void setEngineLibrary(const QString& engineLibrary); |
14164 | 42 |
|
43 |
signals: |
|
44 |
void previewIsRendering(); |
|
45 |
void previewImageChanged(); |
|
46 |
void previewHogCountChanged(int count); |
|
47 |
void gameFinished(); |
|
48 |
void previewHedgehogsCountChanged(int previewHedgehogsCount); |
|
14392
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14319
diff
changeset
|
49 |
void previewAcceptorChanged(PreviewAcceptor* previewAcceptor); |
14393
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14392
diff
changeset
|
50 |
void engineLibraryChanged(const QString& engineLibrary); |
14164 | 51 |
|
15919 | 52 |
void dataPathChanged(); |
53 |
||
54 |
private: |
|
14164 | 55 |
QQmlEngine* m_engine; |
56 |
GameConfig m_gameConfig; |
|
57 |
int m_previewHedgehogsCount; |
|
14392
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14319
diff
changeset
|
58 |
PreviewAcceptor* m_previewAcceptor; |
14393
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14392
diff
changeset
|
59 |
QString m_engineLibrary; |
15919 | 60 |
QString m_dataPath; |
14164 | 61 |
}; |
62 |
||
63 |
#endif // HWENGINE_H |