ddnet/src/game/client/component.h

80 lines
2 KiB
C
Raw Normal View History

2010-11-20 10:37:14 +00:00
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
2010-05-29 07:25:38 +00:00
#ifndef GAME_CLIENT_COMPONENT_H
#define GAME_CLIENT_COMPONENT_H
#if defined(CONF_VIDEORECORDER)
#include <engine/shared/video.h>
#endif
2021-07-12 09:29:59 +00:00
#include <base/color.h>
#include <engine/input.h>
2010-05-29 07:25:38 +00:00
2021-07-12 09:29:59 +00:00
#include <engine/client.h>
#include <engine/console.h>
#include <game/localization.h>
#include <engine/config.h>
class CGameClient;
2010-05-29 07:25:38 +00:00
class CComponent
{
protected:
friend class CGameClient;
CGameClient *m_pClient;
2010-05-29 07:25:38 +00:00
// perhaps propagte pointers for these as well
2021-07-12 09:29:59 +00:00
class IKernel *Kernel() const;
class IGraphics *Graphics() const;
class ITextRender *TextRender() const;
class IInput *Input() const;
class IStorage *Storage() const;
class CUI *UI() const;
class ISound *Sound() const;
class CRenderTools *RenderTools() const;
class CConfig *Config() const;
class IConsole *Console() const;
class IDemoPlayer *DemoPlayer() const;
class IDemoRecorder *DemoRecorder(int Recorder) const;
class IServerBrowser *ServerBrowser() const;
class CLayers *Layers() const;
class CCollision *Collision() const;
#if defined(CONF_AUTOUPDATE)
2021-07-12 09:29:59 +00:00
class IUpdater *Updater() const;
#endif
#if defined(CONF_VIDEORECORDER)
2021-06-23 05:05:49 +00:00
int64_t time() const
{
return IVideo::Current() ? IVideo::Time() : time_get();
}
#else
2021-06-23 05:05:49 +00:00
int64_t time() const
{
return time_get();
}
#endif
2021-07-12 09:29:59 +00:00
float LocalTime() const;
2010-05-29 07:25:38 +00:00
public:
virtual ~CComponent() {}
2014-09-06 23:53:20 +00:00
class CGameClient *GameClient() const { return m_pClient; }
2021-07-12 09:29:59 +00:00
class IClient *Client() const;
virtual void OnStateChange(int NewState, int OldState){};
virtual void OnConsoleInit(){};
virtual void OnInit(){};
virtual void OnReset(){};
virtual void OnWindowResize() {}
virtual void OnRender(){};
virtual void OnRelease(){};
virtual void OnMapLoad(){};
2010-05-29 07:25:38 +00:00
virtual void OnMessage(int Msg, void *pRawMsg) {}
virtual bool OnMouseMove(float x, float y) { return false; }
virtual bool OnInput(IInput::CEvent e) { return false; }
};
#endif