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

44 lines
988 B
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>
2015-08-27 14:28:25 +00:00
#include <game/client/component.h>
#include <game/client/components/maplayers.h>
2015-08-27 14:28:25 +00:00
// 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
int64 m_LastLoad;
//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();
2015-08-27 14:28:25 +00:00
virtual void OnInit();
virtual void OnMapLoad();
virtual void OnRender();
void LoadBackground();
};
#endif