1 | // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QT3DLOGIC_LOGIC_MANAGER_H |
5 | #define QT3DLOGIC_LOGIC_MANAGER_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <Qt3DLogic/qt3dlogic_global.h> |
19 | #include <Qt3DCore/qnodeid.h> |
20 | #include <QtCore/qmutex.h> |
21 | #include <QtCore/qscopedpointer.h> |
22 | #include <QtCore/qsemaphore.h> |
23 | |
24 | #include <Qt3DLogic/private/handle_types_p.h> |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | namespace Qt3DLogic { |
29 | |
30 | class QLogicAspect; |
31 | |
32 | namespace Logic { |
33 | |
34 | class Executor; |
35 | class HandlerManager; |
36 | |
37 | class Manager |
38 | { |
39 | public: |
40 | Manager(); |
41 | ~Manager(); |
42 | |
43 | void setLogicAspect(QLogicAspect *logicAspect) { m_logicAspect = logicAspect; } |
44 | void setExecutor(Executor *executor); |
45 | |
46 | HandlerManager *logicHandlerManager() const { return m_logicHandlerManager.data(); } |
47 | |
48 | void appendHandler(Handler *handler); |
49 | void removeHandler(Qt3DCore::QNodeId id); |
50 | bool hasFrameActions() const; |
51 | |
52 | void triggerLogicFrameUpdates(); |
53 | |
54 | void setDeltaTime(float dt) { m_dt = dt; } |
55 | |
56 | private: |
57 | QScopedPointer<HandlerManager> m_logicHandlerManager; |
58 | QList<HHandler> m_logicHandlers; |
59 | QList<Qt3DCore::QNodeId> m_logicComponentIds; |
60 | QLogicAspect *m_logicAspect; |
61 | Executor *m_executor; |
62 | float m_dt; |
63 | }; |
64 | |
65 | } // namespace Logic |
66 | } // namespace Qt3DLogic |
67 | |
68 | QT_END_NAMESPACE |
69 | |
70 | #endif // QT3DLOGIC_LOGIC_MANAGER_H |
71 | |