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
36protected:
37 bool CanRenderMenuBackground() override { return false; }
38
39public:
40 enum
41 {
68
70
74 };
75
76 enum
77 {
79 };
80
82
84
86 std::array<vec2, NUM_POS> m_aPositions;
92
94
95 void ResetPositions();
96
97 void LoadThemeIcon(CTheme &Theme);
98 static int ThemeScan(const char *pName, int IsDir, int DirType, void *pUser);
99
100 std::vector<CTheme> m_vThemes;
101
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
114 class CCamera *GetCurCamera() override;
115
116 void ChangePosition(int PositionNumber);
117
118 std::vector<CTheme> &GetThemes();
119};
120
121std::array<vec2, CMenuBackground::NUM_POS> GenerateMenuBackgroundPositions();
122
123#endif
Definition: background.h:17
Definition: background.h:22
Definition: camera.h:14
Definition: menu_background.h:33
void ResetPositions()
Definition: menu_background.cpp:93
void OnRender() override
Definition: menu_background.cpp:297
vec2 m_AnimationStartPos
Definition: menu_background.h:89
std::array< vec2, NUM_POS > m_aPositions
Definition: menu_background.h:86
CCamera m_Camera
Definition: menu_background.h:81
int m_CurrentPosition
Definition: menu_background.h:87
bool Render()
Definition: menu_background.cpp:301
std::chrono::nanoseconds m_ThemeScanStartTime
Definition: menu_background.h:34
void OnInit() override
Definition: menu_background.cpp:76
@ POS_BROWSER_LAN
Definition: menu_background.h:58
@ POS_RESERVED0
Definition: menu_background.h:65
@ POS_DEMOS
Definition: menu_background.h:43
@ POS_SETTINGS_TEE
Definition: menu_background.h:48
@ POS_SETTINGS_DDNET
Definition: menu_background.h:53
@ POS_RESERVED2
Definition: menu_background.h:67
@ POS_RESERVED1
Definition: menu_background.h:66
@ POS_SETTINGS_APPEARANCE
Definition: menu_background.h:49
@ POS_SETTINGS_SOUND
Definition: menu_background.h:52
@ POS_SETTINGS_CONTROLS
Definition: menu_background.h:50
@ POS_SETTINGS_RESERVED_NUM
Definition: menu_background.h:72
@ POS_BROWSER_CUSTOM0
Definition: menu_background.h:60
@ POS_BROWSER_FAVORITES
Definition: menu_background.h:59
@ POS_SETTINGS_LANGUAGE
Definition: menu_background.h:45
@ POS_BROWSER_CUSTOM_NUM
Definition: menu_background.h:71
@ POS_NEWS
Definition: menu_background.h:44
@ POS_SETTINGS_GRAPHICS
Definition: menu_background.h:51
@ POS_BROWSER_CUSTOM1
Definition: menu_background.h:61
@ POS_SETTINGS_RESERVED0
Definition: menu_background.h:55
@ POS_SETTINGS_GENERAL
Definition: menu_background.h:46
@ POS_BROWSER_CUSTOM2
Definition: menu_background.h:62
@ POS_SETTINGS_PLAYER
Definition: menu_background.h:47
@ POS_START
Definition: menu_background.h:42
@ POS_BROWSER_INTERNET
Definition: menu_background.h:57
@ POS_SETTINGS_ASSETS
Definition: menu_background.h:54
@ POS_BROWSER_CUSTOM4
Definition: menu_background.h:64
@ POS_RESERVED_NUM
Definition: menu_background.h:73
@ POS_BROWSER_CUSTOM3
Definition: menu_background.h:63
@ POS_SETTINGS_RESERVED1
Definition: menu_background.h:56
@ NUM_POS
Definition: menu_background.h:69
std::vector< CTheme > & GetThemes()
Definition: menu_background.cpp:381
void OnMapLoad() override
Definition: menu_background.cpp:293
std::vector< CTheme > m_vThemes
Definition: menu_background.h:100
bool m_IsInit
Definition: menu_background.h:93
vec2 m_CurrentDirection
Definition: menu_background.h:88
float m_MoveTime
Definition: menu_background.h:91
CBackgroundEngineMap * CreateBGMap() override
Definition: menu_background.cpp:71
virtual int Sizeof() const override
Definition: menu_background.h:104
void LoadMenuBackground(bool HasDayHint=true, bool HasNightHint=true)
Definition: menu_background.cpp:167
CMenuBackground()
Definition: menu_background.cpp:54
class CCamera * GetCurCamera() override
Definition: menu_background.cpp:356
static int ThemeScan(const char *pName, int IsDir, int DirType, void *pUser)
Definition: menu_background.cpp:112
bool CanRenderMenuBackground() override
Definition: menu_background.h:37
void ChangePosition(int PositionNumber)
Definition: menu_background.cpp:361
@ PREDEFINED_THEMES_COUNT
Definition: menu_background.h:78
bool m_ChangedPosition
Definition: menu_background.h:90
vec2 m_RotationCenter
Definition: menu_background.h:85
~CMenuBackground() override
Definition: menu_background.h:103
void LoadThemeIcon(CTheme &Theme)
Definition: menu_background.cpp:98
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:200
#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