ddnet/src/game/client/components/background.h

51 lines
1.1 KiB
C
Raw Normal View History

2015-08-27 14:28:25 +00:00
#ifndef GAME_CLIENT_COMPONENTS_BACKGROUND_H
#define GAME_CLIENT_COMPONENTS_BACKGROUND_H
2020-09-18 16:45:42 +00:00
#include <engine/shared/map.h>
#include <game/client/components/maplayers.h>
2015-08-27 14:28:25 +00:00
#include <stdint.h>
class CLayers;
class CMapImages;
// Special value to use background of current map
2020-10-02 14:21:18 +00:00
#define CURRENT_MAP "%current%"
2015-08-27 14:32:45 +00:00
2020-09-18 16:45:42 +00:00
class CBackgroundEngineMap : public CMap
{
MACRO_INTERFACE("background_enginemap", 0)
};
class CBackground : public CMapLayers
2015-08-27 14:28:25 +00:00
{
2020-09-18 16:45:42 +00:00
protected:
2015-08-27 14:28:25 +00:00
IEngineMap *m_pMap;
bool m_Loaded;
2020-06-18 16:29:27 +00:00
char m_aMapName[MAX_MAP_LENGTH];
2015-08-27 14:28:25 +00:00
//to avoid spam when in menu
2021-06-23 05:05:49 +00:00
int64_t m_LastLoad;
2015-08-27 14:28:25 +00:00
//to avoid memory leak when switching to %current%
2020-09-18 16:45:42 +00:00
CBackgroundEngineMap *m_pBackgroundMap;
2015-08-27 14:28:25 +00:00
CLayers *m_pBackgroundLayers;
CMapImages *m_pBackgroundImages;
2020-09-18 16:45:42 +00:00
virtual CBackgroundEngineMap *CreateBGMap();
2015-08-27 14:28:25 +00:00
public:
2020-09-18 16:45:42 +00:00
CBackground(int MapType = CMapLayers::TYPE_BACKGROUND_FORCE, bool OnlineOnly = true);
virtual ~CBackground();
virtual int Sizeof() const override { return sizeof(*this); }
2015-08-27 14:28:25 +00:00
virtual void OnInit() override;
virtual void OnMapLoad() override;
virtual void OnRender() override;
2015-08-27 14:28:25 +00:00
void LoadBackground();
};
#endif