author | unC0Rr |
Thu, 19 Dec 2024 12:43:38 +0100 | |
branch | transitional_engine |
changeset 16051 | a5eaeefa4ab3 |
parent 16010 | a73b9770467a |
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 "game_config.h" |
16010
a73b9770467a
Port QML frontend to Qt6, use rendering to framebuffer object
unC0Rr
parents:
15891
diff
changeset
|
8 |
#include "preview_acceptor.h" |
14143 | 9 |
|
10 |
class QQmlEngine; |
|
14298 | 11 |
class EngineInstance; |
14143 | 12 |
|
13 |
class HWEngine : public QObject { |
|
14 |
Q_OBJECT |
|
15 |
||
16 |
Q_PROPERTY(int previewHedgehogsCount READ previewHedgehogsCount NOTIFY |
|
17 |
previewHedgehogsCountChanged) |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
18 |
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
|
19 |
setPreviewAcceptor NOTIFY previewAcceptorChanged) |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
20 |
Q_PROPERTY(QString engineLibrary READ engineLibrary WRITE setEngineLibrary |
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
21 |
NOTIFY engineLibraryChanged) |
15891 | 22 |
Q_PROPERTY(QString dataPath READ dataPath WRITE setDataPath NOTIFY dataPathChanged) |
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); |
16010
a73b9770467a
Port QML frontend to Qt6, use rendering to framebuffer object
unC0Rr
parents:
15891
diff
changeset
|
26 |
~HWEngine() override; |
14143 | 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 |
|
15891 | 35 |
const QString &dataPath() const; |
36 |
void setDataPath(const QString &newDataPath); |
|
37 |
||
38 |
public slots: |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
39 |
void setPreviewAcceptor(PreviewAcceptor* previewAcceptor); |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
40 |
void setEngineLibrary(const QString& engineLibrary); |
14143 | 41 |
|
42 |
signals: |
|
43 |
void previewIsRendering(); |
|
44 |
void previewImageChanged(); |
|
45 |
void previewHogCountChanged(int count); |
|
46 |
void gameFinished(); |
|
47 |
void previewHedgehogsCountChanged(int previewHedgehogsCount); |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
48 |
void previewAcceptorChanged(PreviewAcceptor* previewAcceptor); |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
49 |
void engineLibraryChanged(const QString& engineLibrary); |
14143 | 50 |
|
15891 | 51 |
void dataPathChanged(); |
52 |
||
53 |
private: |
|
14143 | 54 |
QQmlEngine* m_engine; |
55 |
GameConfig m_gameConfig; |
|
56 |
int m_previewHedgehogsCount; |
|
14371
90bd2c331703
Add possibility to instantiate HWEngine objects from QML, reorganize work with preview
unC0Rr
parents:
14298
diff
changeset
|
57 |
PreviewAcceptor* m_previewAcceptor; |
14372
b6824a53d4b1
Allow to instantiate HWEngine with different library binaries
unC0Rr
parents:
14371
diff
changeset
|
58 |
QString m_engineLibrary; |
15891 | 59 |
QString m_dataPath; |
14143 | 60 |
}; |
61 |
||
62 |
#endif // HWENGINE_H |