DDraceNetwork Docs
component.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef GAME_CLIENT_COMPONENT_H
4#define GAME_CLIENT_COMPONENT_H
5
6#if defined(CONF_VIDEORECORDER)
8#endif
9
10#include <engine/input.h>
11
12class CGameClient;
13
20{
21protected:
22 friend class CGameClient;
23
25
26 // perhaps propagate pointers for these as well
27
31 class IKernel *Kernel() const;
32 class IEngine *Engine() const;
36 class IGraphics *Graphics() const;
40 class ITextRender *TextRender() const;
44 class IInput *Input() const;
48 class IStorage *Storage() const;
52 class CUi *Ui() const;
56 class ISound *Sound() const;
60 class CRenderTools *RenderTools() const;
64 class IConfigManager *ConfigManager() const;
68 class CConfig *Config() const;
72 class IConsole *Console() const;
76 class IDemoPlayer *DemoPlayer() const;
86 class IDemoRecorder *DemoRecorder(int Recorder) const;
87 class IFavorites *Favorites() const;
91 class IServerBrowser *ServerBrowser() const;
95 class CLayers *Layers() const;
99 class CCollision *Collision() const;
100#if defined(CONF_AUTOUPDATE)
104 class IUpdater *Updater() const;
105#endif
106
111 int64_t time() const;
112
116 float LocalTime() const;
117
121 class IHttp *Http() const;
122
123public:
127 virtual ~CComponent() {}
131 virtual int Sizeof() const = 0;
135 class CGameClient *GameClient() const { return m_pClient; }
139 class IClient *Client() const;
140
147 virtual void OnStateChange(int NewState, int OldState){};
151 virtual void OnConsoleInit(){};
155 virtual void OnInit(){};
160 virtual void OnShutdown(){};
167 virtual void OnReset(){};
171 virtual void OnWindowResize() {}
175 virtual void OnRefreshSkins() {}
181 virtual void OnRender(){};
185 virtual void OnNewSnapshot(){};
189 virtual void OnRelease(){};
193 virtual void OnMapLoad(){};
201 virtual void OnMessage(int Msg, void *pRawMsg) {}
209 virtual bool OnCursorMove(float x, float y, IInput::ECursorType CursorType) { return false; }
214 virtual bool OnInput(const IInput::CEvent &Event) { return false; }
215};
216
217#endif
Definition: collision.h:34
Definition: component.h:20
virtual void OnRefreshSkins()
Definition: component.h:175
virtual void OnStateChange(int NewState, int OldState)
Definition: component.h:147
virtual void OnMapLoad()
Definition: component.h:193
virtual int Sizeof() const =0
class ISound * Sound() const
Definition: component.cpp:14
virtual ~CComponent()
Definition: component.h:127
class IHttp * Http() const
Definition: component.cpp:55
virtual void OnWindowResize()
Definition: component.h:171
class IGraphics * Graphics() const
Definition: component.cpp:9
class IServerBrowser * ServerBrowser() const
Definition: component.cpp:22
virtual void OnShutdown()
Definition: component.h:160
class IClient * Client() const
Definition: component.cpp:50
virtual void OnInit()
Definition: component.h:155
CGameClient * m_pClient
Definition: component.h:24
class IKernel * Kernel() const
Definition: component.cpp:7
virtual bool OnInput(const IInput::CEvent &Event)
Definition: component.h:214
virtual void OnMessage(int Msg, void *pRawMsg)
Definition: component.h:201
class IDemoPlayer * DemoPlayer() const
Definition: component.cpp:19
class IStorage * Storage() const
Definition: component.cpp:12
class CUi * Ui() const
Definition: component.cpp:13
virtual void OnReset()
Definition: component.h:167
class CGameClient * GameClient() const
Definition: component.h:135
virtual void OnConsoleInit()
Definition: component.h:151
class CLayers * Layers() const
Definition: component.cpp:23
class IEngine * Engine() const
Definition: component.cpp:8
class CRenderTools * RenderTools() const
Definition: component.cpp:15
class IDemoRecorder * DemoRecorder(int Recorder) const
Definition: component.cpp:20
class IInput * Input() const
Definition: component.cpp:11
virtual void OnRelease()
Definition: component.h:189
class CConfig * Config() const
Definition: component.cpp:17
class IFavorites * Favorites() const
Definition: component.cpp:21
virtual void OnNewSnapshot()
Definition: component.h:185
virtual bool OnCursorMove(float x, float y, IInput::ECursorType CursorType)
Definition: component.h:209
int64_t time() const
Definition: component.cpp:32
float LocalTime() const
Definition: component.cpp:41
class ITextRender * TextRender() const
Definition: component.cpp:10
class CCollision * Collision() const
Definition: component.cpp:24
virtual void OnRender()
Definition: component.h:181
class IConsole * Console() const
Definition: component.cpp:18
class IConfigManager * ConfigManager() const
Definition: component.cpp:16
Definition: config.h:23
Definition: gameclient.h:124
Definition: layers.h:13
Definition: render.h:188
Definition: ui.h:283
Definition: client.h:36
Definition: config.h:9
Definition: console.h:18
Definition: demo.h:60
Definition: demo.h:102
Definition: engine.h:15
Definition: favorites.h:14
Definition: graphics.h:183
Definition: http.h:12
Definition: input.h:24
Definition: input.h:20
ECursorType
Definition: input.h:39
Definition: kernel.h:34
Definition: serverbrowser.h:263
Definition: sound.h:12
Definition: storage.h:20
Definition: textrender.h:312
Definition: updater.h:7