1 | #ifndef GAME_EDITOR_COMPONENT_H |
2 | #define GAME_EDITOR_COMPONENT_H |
3 | |
4 | #include "editor_object.h" |
5 | |
6 | #include <vector> |
7 | |
8 | class CEditorComponent : public CEditorObject |
9 | { |
10 | public: |
11 | /** |
12 | * Gets called before `OnRender`. Should return true |
13 | * if the event was consumed. By default the events |
14 | * are forwarded to the subcomponents. |
15 | */ |
16 | virtual bool OnInput(const IInput::CEvent &Event) override; |
17 | |
18 | /** |
19 | * Initialise all registered subcomponents. |
20 | * Needs to be called after the interfaces have been initialised. |
21 | */ |
22 | void InitSubComponents(); |
23 | |
24 | // Register a new subcomponent. |
25 | void RegisterSubComponent(CEditorComponent &Component); |
26 | |
27 | private: |
28 | std::vector<std::reference_wrapper<CEditorComponent>> m_vSubComponents = {}; |
29 | }; |
30 | |
31 | #endif |
32 | |