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
|
|
|
|
|
2016-08-30 23:39:59 +00:00
|
|
|
#if defined(CONF_VIDEORECORDER)
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <engine/shared/video.h>
|
2016-08-30 23:39:59 +00:00
|
|
|
#endif
|
|
|
|
|
2021-07-12 09:29:59 +00:00
|
|
|
#include <base/color.h>
|
2020-09-26 19:41:58 +00:00
|
|
|
#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;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
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;
|
2020-07-09 22:01:00 +00:00
|
|
|
#if defined(CONF_AUTOUPDATE)
|
2021-07-12 09:29:59 +00:00
|
|
|
class IUpdater *Updater() const;
|
2020-07-09 22:01:00 +00:00
|
|
|
#endif
|
2016-08-30 23:39:59 +00:00
|
|
|
|
|
|
|
#if defined(CONF_VIDEORECORDER)
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t time() const
|
2020-09-26 19:41:58 +00:00
|
|
|
{
|
|
|
|
return IVideo::Current() ? IVideo::Time() : time_get();
|
|
|
|
}
|
2016-08-30 23:39:59 +00:00
|
|
|
#else
|
2021-06-23 05:05:49 +00:00
|
|
|
int64_t time() const
|
2020-09-26 19:41:58 +00:00
|
|
|
{
|
|
|
|
return time_get();
|
|
|
|
}
|
2016-08-30 23:39:59 +00:00
|
|
|
#endif
|
2021-07-12 09:29:59 +00:00
|
|
|
float LocalTime() const;
|
2016-08-30 23:39:59 +00:00
|
|
|
|
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;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
virtual void OnStateChange(int NewState, int OldState){};
|
|
|
|
virtual void OnConsoleInit(){};
|
|
|
|
virtual void OnInit(){};
|
|
|
|
virtual void OnReset(){};
|
2018-03-21 14:53:29 +00:00
|
|
|
virtual void OnWindowResize() {}
|
2020-09-26 19:41:58 +00:00
|
|
|
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
|