author | unC0Rr |
Tue, 17 Dec 2024 15:44:21 +0100 | |
branch | transitional_engine |
changeset 16078 | db18f1a30b0c |
parent 16046 | e8afb1bf2779 |
permissions | -rw-r--r-- |
14164 | 1 |
#ifndef GAMEVIEW_H |
2 |
#define GAMEVIEW_H |
|
3 |
||
14311
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
4 |
#include <QPointer> |
16039
a73b9770467a
Port QML frontend to Qt6, use rendering to framebuffer object
unC0Rr
parents:
14863
diff
changeset
|
5 |
#include <QQuickFramebufferObject> |
14311
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
6 |
#include <QScopedPointer> |
14164 | 7 |
|
14311
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
8 |
#include "engine_instance.h" |
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
9 |
|
16039
a73b9770467a
Port QML frontend to Qt6, use rendering to framebuffer object
unC0Rr
parents:
14863
diff
changeset
|
10 |
class GameView : public QQuickFramebufferObject { |
14164 | 11 |
Q_OBJECT |
12 |
||
14311
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
13 |
Q_PROPERTY(EngineInstance* engineInstance READ engineInstance WRITE |
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
14 |
setEngineInstance NOTIFY engineInstanceChanged) |
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
15 |
|
14164 | 16 |
public: |
14863 | 17 |
explicit GameView(QQuickItem* parent = nullptr); |
14164 | 18 |
|
19 |
Q_INVOKABLE void tick(quint32 delta); |
|
20 |
||
14311
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
21 |
EngineInstance* engineInstance() const; |
16039
a73b9770467a
Port QML frontend to Qt6, use rendering to framebuffer object
unC0Rr
parents:
14863
diff
changeset
|
22 |
Renderer* createRenderer() const override; |
16046
e8afb1bf2779
Implement triggering advancement of simulation in qmlfrontend
unC0Rr
parents:
16039
diff
changeset
|
23 |
void executeActions(); |
16039
a73b9770467a
Port QML frontend to Qt6, use rendering to framebuffer object
unC0Rr
parents:
14863
diff
changeset
|
24 |
|
a73b9770467a
Port QML frontend to Qt6, use rendering to framebuffer object
unC0Rr
parents:
14863
diff
changeset
|
25 |
Q_SIGNALS: |
14311
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
26 |
void engineInstanceChanged(EngineInstance* engineInstance); |
14164 | 27 |
|
16039
a73b9770467a
Port QML frontend to Qt6, use rendering to framebuffer object
unC0Rr
parents:
14863
diff
changeset
|
28 |
public Q_SLOTS: |
14311
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
29 |
void setEngineInstance(EngineInstance* engineInstance); |
14164 | 30 |
|
31 |
private: |
|
14311
92e5682810d4
Prepare to have possibility to pass opengl context to engine
unc0rr
parents:
14175
diff
changeset
|
32 |
QPointer<EngineInstance> m_engineInstance; |
14733 | 33 |
QSize m_viewportSize; |
14734 | 34 |
QPoint m_centerPoint; |
16046
e8afb1bf2779
Implement triggering advancement of simulation in qmlfrontend
unC0Rr
parents:
16039
diff
changeset
|
35 |
QList<std::function<void(EngineInstance*)>> m_actions; |
e8afb1bf2779
Implement triggering advancement of simulation in qmlfrontend
unC0Rr
parents:
16039
diff
changeset
|
36 |
|
e8afb1bf2779
Implement triggering advancement of simulation in qmlfrontend
unC0Rr
parents:
16039
diff
changeset
|
37 |
void addAction(std::function<void(EngineInstance*)>&& action); |
14164 | 38 |
}; |
39 |
||
40 |
#endif // GAMEVIEW_H |