DDraceNetwork Docs
menu_background.h
Go to the documentation of this file.
1#ifndef GAME_CLIENT_COMPONENTS_MENU_BACKGROUND_H
2#define GAME_CLIENT_COMPONENTS_MENU_BACKGROUND_H
3
6
7#include <array>
8#include <chrono>
9#include <string>
10#include <vector>
11
13{
14 MACRO_INTERFACE("menu_enginemap")
15};
16
17// themes
18class CTheme
19{
20public:
21 CTheme() {}
22 CTheme(const char *pName, bool HasDay, bool HasNight) :
23 m_Name(pName), m_HasDay(HasDay), m_HasNight(HasNight) {}
24
25 std::string m_Name;
29 bool operator<(const CTheme &Other) const { return m_Name < Other.m_Name; }
30};
31
33{
34 std::chrono::nanoseconds m_ThemeScanStartTime{0};
35
36public:
37 enum
38 {
65
67
71 };
72
73 enum
74 {
76 };
77
78private:
80
82
84 std::array<vec2, NUM_POS> m_aPositions;
90
93
94 void ResetPositions();
95
96 void LoadThemeIcon(CTheme &Theme);
97 static int ThemeScan(const char *pName, int IsDir, int DirType, void *pUser);
98
99 std::vector<CTheme> m_vThemes;
100
101public:
103 ~CMenuBackground() override {}
104 virtual int Sizeof() const override { return sizeof(*this); }
105
106 void OnInit() override;
107 void OnMapLoad() override;
108 void OnRender() override;
109
110 void LoadMenuBackground(bool HasDayHint = true, bool HasNightHint = true);
111
112 bool Render();
113 bool IsLoading() const { return m_Loading; }
114
115 class CCamera *GetCurCamera() override;
116 const char *LoadingTitle() const override;
117
118 void ChangePosition(int PositionNumber);
119
120 std::vector<CTheme> &GetThemes();
121};
122
123std::array<vec2, CMenuBackground::NUM_POS> GenerateMenuBackgroundPositions();
124
125#endif
Definition: background.h:17
Definition: background.h:22
Definition: camera.h:14
Definition: menu_background.h:33
void ResetPositions()
Definition: menu_background.cpp:94
bool IsLoading() const
Definition: menu_background.h:113
void OnRender() override
Definition: menu_background.cpp:301
vec2 m_AnimationStartPos
Definition: menu_background.h:87
std::array< vec2, NUM_POS > m_aPositions
Definition: menu_background.h:84
CCamera m_Camera
Definition: menu_background.h:79
int m_CurrentPosition
Definition: menu_background.h:85
bool Render()
Definition: menu_background.cpp:305
std::chrono::nanoseconds m_ThemeScanStartTime
Definition: menu_background.h:34
void OnInit() override
Definition: menu_background.cpp:77
@ POS_BROWSER_LAN
Definition: menu_background.h:55
@ POS_RESERVED0
Definition: menu_background.h:62
@ POS_DEMOS
Definition: menu_background.h:40
@ POS_SETTINGS_TEE
Definition: menu_background.h:45
@ POS_SETTINGS_DDNET
Definition: menu_background.h:50
@ POS_RESERVED2
Definition: menu_background.h:64
@ POS_RESERVED1
Definition: menu_background.h:63
@ POS_SETTINGS_APPEARANCE
Definition: menu_background.h:46
@ POS_SETTINGS_SOUND
Definition: menu_background.h:49
@ POS_SETTINGS_CONTROLS
Definition: menu_background.h:47
@ POS_SETTINGS_RESERVED_NUM
Definition: menu_background.h:69
@ POS_BROWSER_CUSTOM0
Definition: menu_background.h:57
@ POS_BROWSER_FAVORITES
Definition: menu_background.h:56
@ POS_SETTINGS_LANGUAGE
Definition: menu_background.h:42
@ POS_BROWSER_CUSTOM_NUM
Definition: menu_background.h:68
@ POS_NEWS
Definition: menu_background.h:41
@ POS_SETTINGS_GRAPHICS
Definition: menu_background.h:48
@ POS_BROWSER_CUSTOM1
Definition: menu_background.h:58
@ POS_SETTINGS_RESERVED0
Definition: menu_background.h:52
@ POS_SETTINGS_GENERAL
Definition: menu_background.h:43
@ POS_BROWSER_CUSTOM2
Definition: menu_background.h:59
@ POS_SETTINGS_PLAYER
Definition: menu_background.h:44
@ POS_START
Definition: menu_background.h:39
@ POS_BROWSER_INTERNET
Definition: menu_background.h:54
@ POS_SETTINGS_ASSETS
Definition: menu_background.h:51
@ POS_BROWSER_CUSTOM4
Definition: menu_background.h:61
@ POS_RESERVED_NUM
Definition: menu_background.h:70
@ POS_BROWSER_CUSTOM3
Definition: menu_background.h:60
@ POS_SETTINGS_RESERVED1
Definition: menu_background.h:53
@ NUM_POS
Definition: menu_background.h:66
std::vector< CTheme > & GetThemes()
Definition: menu_background.cpp:390
void OnMapLoad() override
Definition: menu_background.cpp:297
std::vector< CTheme > m_vThemes
Definition: menu_background.h:99
bool m_IsInit
Definition: menu_background.h:91
vec2 m_CurrentDirection
Definition: menu_background.h:86
float m_MoveTime
Definition: menu_background.h:89
CBackgroundEngineMap * CreateBGMap() override
Definition: menu_background.cpp:72
virtual int Sizeof() const override
Definition: menu_background.h:104
void LoadMenuBackground(bool HasDayHint=true, bool HasNightHint=true)
Definition: menu_background.cpp:168
CMenuBackground()
Definition: menu_background.cpp:54
class CCamera * GetCurCamera() override
Definition: menu_background.cpp:360
static int ThemeScan(const char *pName, int IsDir, int DirType, void *pUser)
Definition: menu_background.cpp:113
bool m_Loading
Definition: menu_background.h:92
void ChangePosition(int PositionNumber)
Definition: menu_background.cpp:370
@ PREDEFINED_THEMES_COUNT
Definition: menu_background.h:75
bool m_ChangedPosition
Definition: menu_background.h:88
vec2 m_RotationCenter
Definition: menu_background.h:83
const char * LoadingTitle() const override
Definition: menu_background.cpp:365
~CMenuBackground() override
Definition: menu_background.h:103
void LoadThemeIcon(CTheme &Theme)
Definition: menu_background.cpp:99
Definition: menu_background.h:13
Definition: menu_background.h:19
bool m_HasDay
Definition: menu_background.h:26
CTheme()
Definition: menu_background.h:21
IGraphics::CTextureHandle m_IconTexture
Definition: menu_background.h:28
CTheme(const char *pName, bool HasDay, bool HasNight)
Definition: menu_background.h:22
bool operator<(const CTheme &Other) const
Definition: menu_background.h:29
bool m_HasNight
Definition: menu_background.h:27
std::string m_Name
Definition: menu_background.h:25
Definition: graphics.h:201
#define MACRO_INTERFACE(Name)
Definition: kernel.h:25
std::array< vec2, CMenuBackground::NUM_POS > GenerateMenuBackgroundPositions()
Definition: menu_background.cpp:24
vector2_base< float > vec2
Definition: vmath.h:158