1#ifndef GAME_CLIENT_COMPONENTS_BACKGROUND_H
2#define GAME_CLIENT_COMPONENTS_BACKGROUND_H
3
4#include <engine/shared/map.h>
5
6#include <game/client/components/maplayers.h>
7
8#include <cstdint>
9
10class CLayers;
11class CMapImages;
12
13// Special value to use background of current map
14#define CURRENT_MAP "%current%"
15
16class CBackgroundEngineMap : public CMap
17{
18 MACRO_INTERFACE("background_enginemap")
19};
20
21class CBackground : public CMapLayers
22{
23protected:
24 IEngineMap *m_pMap;
25 bool m_Loaded;
26 char m_aMapName[MAX_MAP_LENGTH];
27
28 //to avoid memory leak when switching to %current%
29 CBackgroundEngineMap *m_pBackgroundMap;
30 CLayers *m_pBackgroundLayers;
31 CMapImages *m_pBackgroundImages;
32
33 virtual CBackgroundEngineMap *CreateBGMap();
34
35public:
36 CBackground(int MapType = CMapLayers::TYPE_BACKGROUND_FORCE, bool OnlineOnly = true);
37 virtual ~CBackground();
38 virtual int Sizeof() const override { return sizeof(*this); }
39
40 virtual void OnInit() override;
41 virtual void OnMapLoad() override;
42 virtual void OnRender() override;
43
44 void LoadBackground();
45 const char *MapName() const { return m_aMapName; }
46};
47
48#endif
49