1 | #ifndef GAME_EDITOR_EDITOR_OBJECT_H |
2 | #define GAME_EDITOR_EDITOR_OBJECT_H |
3 | |
4 | #include <functional> |
5 | |
6 | #include <engine/input.h> |
7 | #include <game/client/ui_rect.h> |
8 | |
9 | class CUi; |
10 | class CEditor; |
11 | class IClient; |
12 | class CConfig; |
13 | class IConsole; |
14 | class IEngine; |
15 | class IGraphics; |
16 | class ISound; |
17 | class ITextRender; |
18 | class IStorage; |
19 | class CRenderTools; |
20 | |
21 | class CEditorObject |
22 | { |
23 | public: |
24 | virtual ~CEditorObject() = default; |
25 | |
26 | /** |
27 | * Initialise the component and interface pointers. |
28 | * Needs to be the first function that is called. |
29 | * The default implentation also resets the component. |
30 | */ |
31 | virtual void Init(CEditor *pEditor); |
32 | |
33 | /** |
34 | * Maybe calls `OnHot` or `OnActive`. |
35 | */ |
36 | virtual void OnUpdate(); |
37 | |
38 | /** |
39 | * Gets called before `OnRender`. Should return true |
40 | * if the event was consumed. |
41 | */ |
42 | virtual bool OnInput(const IInput::CEvent &Event); |
43 | |
44 | virtual void OnRender(CUIRect View); |
45 | |
46 | /** |
47 | * Gets called after `OnRender` when the component is hot but not active. |
48 | */ |
49 | virtual void OnHot(); |
50 | |
51 | /** |
52 | * Gets called after `OnRender` when the component is active. |
53 | */ |
54 | virtual void OnActive(); |
55 | |
56 | virtual void OnReset(); |
57 | virtual void OnMapLoad(); |
58 | |
59 | bool IsHot(); |
60 | void SetHot(); |
61 | void UnsetHot(); |
62 | |
63 | bool IsActive(); |
64 | void SetActive(); |
65 | void SetInactive(); |
66 | |
67 | CEditor *Editor(); |
68 | const CEditor *Editor() const; |
69 | IInput *Input(); |
70 | IClient *Client(); |
71 | CConfig *Config(); |
72 | IConsole *Console(); |
73 | IEngine *Engine(); |
74 | IGraphics *Graphics(); |
75 | ISound *Sound(); |
76 | ITextRender *TextRender(); |
77 | IStorage *Storage(); |
78 | CUi *Ui(); |
79 | CRenderTools *RenderTools(); |
80 | |
81 | private: |
82 | CEditor *m_pEditor; |
83 | }; |
84 | |
85 | #endif |
86 | |