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
4
#include <
game/client/components/background.h
>
5
#include <
game/client/components/camera.h
>
6
7
#include <array>
8
#include <chrono>
9
#include <string>
10
#include <vector>
11
12
class
CMenuMap
:
public
CBackgroundEngineMap
13
{
14
MACRO_INTERFACE
(
"menu_enginemap"
)
15
};
16
17
// themes
18
class
CTheme
19
{
20
public
:
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
;
26
bool
m_HasDay
;
27
bool
m_HasNight
;
28
IGraphics::CTextureHandle
m_IconTexture
;
29
bool
operator<
(
const
CTheme
&Other)
const
{
return
m_Name
< Other.
m_Name
; }
30
};
31
32
class
CMenuBackground
:
public
CBackground
33
{
34
std::chrono::nanoseconds
m_ThemeScanStartTime
{0};
35
36
protected
:
37
bool
CanRenderMenuBackground
()
override
{
return
false
; }
38
39
public
:
40
enum
41
{
42
POS_START
= 0,
43
POS_DEMOS
,
44
POS_NEWS
,
45
POS_SETTINGS_LANGUAGE
,
46
POS_SETTINGS_GENERAL
,
47
POS_SETTINGS_PLAYER
,
48
POS_SETTINGS_TEE
,
49
POS_SETTINGS_APPEARANCE
,
50
POS_SETTINGS_CONTROLS
,
51
POS_SETTINGS_GRAPHICS
,
52
POS_SETTINGS_SOUND
,
53
POS_SETTINGS_DDNET
,
54
POS_SETTINGS_ASSETS
,
55
POS_SETTINGS_RESERVED0
,
56
POS_SETTINGS_RESERVED1
,
57
POS_BROWSER_INTERNET
,
58
POS_BROWSER_LAN
,
59
POS_BROWSER_FAVORITES
,
60
POS_BROWSER_CUSTOM0
,
61
POS_BROWSER_CUSTOM1
,
62
POS_BROWSER_CUSTOM2
,
63
POS_BROWSER_CUSTOM3
,
64
POS_BROWSER_CUSTOM4
,
65
POS_RESERVED0
,
66
POS_RESERVED1
,
67
POS_RESERVED2
,
68
69
NUM_POS
,
70
71
POS_BROWSER_CUSTOM_NUM
= (
POS_BROWSER_CUSTOM4
-
POS_BROWSER_CUSTOM0
) + 1,
72
POS_SETTINGS_RESERVED_NUM
= (
POS_SETTINGS_RESERVED1
-
POS_SETTINGS_RESERVED0
) + 1,
73
POS_RESERVED_NUM
= (
POS_RESERVED2
-
POS_RESERVED0
) + 1,
74
};
75
76
enum
77
{
78
PREDEFINED_THEMES_COUNT
= 3,
79
};
80
81
CCamera
m_Camera
;
82
83
CBackgroundEngineMap
*
CreateBGMap
()
override
;
84
85
vec2
m_RotationCenter
;
86
std::array<vec2, NUM_POS>
m_aPositions
;
87
int
m_CurrentPosition
;
88
vec2
m_CurrentDirection
=
vec2
(1.0f, 0.0f);
89
vec2
m_AnimationStartPos
;
90
bool
m_ChangedPosition
;
91
float
m_MoveTime
;
92
93
bool
m_IsInit
;
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
102
CMenuBackground
();
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
121
std::array<vec2, CMenuBackground::NUM_POS>
GenerateMenuBackgroundPositions
();
122
123
#endif
background.h
camera.h
CBackgroundEngineMap
Definition:
background.h:17
CBackground
Definition:
background.h:22
CCamera
Definition:
camera.h:14
CMenuBackground
Definition:
menu_background.h:33
CMenuBackground::ResetPositions
void ResetPositions()
Definition:
menu_background.cpp:93
CMenuBackground::OnRender
void OnRender() override
Definition:
menu_background.cpp:297
CMenuBackground::m_AnimationStartPos
vec2 m_AnimationStartPos
Definition:
menu_background.h:89
CMenuBackground::m_aPositions
std::array< vec2, NUM_POS > m_aPositions
Definition:
menu_background.h:86
CMenuBackground::m_Camera
CCamera m_Camera
Definition:
menu_background.h:81
CMenuBackground::m_CurrentPosition
int m_CurrentPosition
Definition:
menu_background.h:87
CMenuBackground::Render
bool Render()
Definition:
menu_background.cpp:301
CMenuBackground::m_ThemeScanStartTime
std::chrono::nanoseconds m_ThemeScanStartTime
Definition:
menu_background.h:34
CMenuBackground::OnInit
void OnInit() override
Definition:
menu_background.cpp:76
CMenuBackground::POS_BROWSER_LAN
@ POS_BROWSER_LAN
Definition:
menu_background.h:58
CMenuBackground::POS_RESERVED0
@ POS_RESERVED0
Definition:
menu_background.h:65
CMenuBackground::POS_DEMOS
@ POS_DEMOS
Definition:
menu_background.h:43
CMenuBackground::POS_SETTINGS_TEE
@ POS_SETTINGS_TEE
Definition:
menu_background.h:48
CMenuBackground::POS_SETTINGS_DDNET
@ POS_SETTINGS_DDNET
Definition:
menu_background.h:53
CMenuBackground::POS_RESERVED2
@ POS_RESERVED2
Definition:
menu_background.h:67
CMenuBackground::POS_RESERVED1
@ POS_RESERVED1
Definition:
menu_background.h:66
CMenuBackground::POS_SETTINGS_APPEARANCE
@ POS_SETTINGS_APPEARANCE
Definition:
menu_background.h:49
CMenuBackground::POS_SETTINGS_SOUND
@ POS_SETTINGS_SOUND
Definition:
menu_background.h:52
CMenuBackground::POS_SETTINGS_CONTROLS
@ POS_SETTINGS_CONTROLS
Definition:
menu_background.h:50
CMenuBackground::POS_SETTINGS_RESERVED_NUM
@ POS_SETTINGS_RESERVED_NUM
Definition:
menu_background.h:72
CMenuBackground::POS_BROWSER_CUSTOM0
@ POS_BROWSER_CUSTOM0
Definition:
menu_background.h:60
CMenuBackground::POS_BROWSER_FAVORITES
@ POS_BROWSER_FAVORITES
Definition:
menu_background.h:59
CMenuBackground::POS_SETTINGS_LANGUAGE
@ POS_SETTINGS_LANGUAGE
Definition:
menu_background.h:45
CMenuBackground::POS_BROWSER_CUSTOM_NUM
@ POS_BROWSER_CUSTOM_NUM
Definition:
menu_background.h:71
CMenuBackground::POS_NEWS
@ POS_NEWS
Definition:
menu_background.h:44
CMenuBackground::POS_SETTINGS_GRAPHICS
@ POS_SETTINGS_GRAPHICS
Definition:
menu_background.h:51
CMenuBackground::POS_BROWSER_CUSTOM1
@ POS_BROWSER_CUSTOM1
Definition:
menu_background.h:61
CMenuBackground::POS_SETTINGS_RESERVED0
@ POS_SETTINGS_RESERVED0
Definition:
menu_background.h:55
CMenuBackground::POS_SETTINGS_GENERAL
@ POS_SETTINGS_GENERAL
Definition:
menu_background.h:46
CMenuBackground::POS_BROWSER_CUSTOM2
@ POS_BROWSER_CUSTOM2
Definition:
menu_background.h:62
CMenuBackground::POS_SETTINGS_PLAYER
@ POS_SETTINGS_PLAYER
Definition:
menu_background.h:47
CMenuBackground::POS_START
@ POS_START
Definition:
menu_background.h:42
CMenuBackground::POS_BROWSER_INTERNET
@ POS_BROWSER_INTERNET
Definition:
menu_background.h:57
CMenuBackground::POS_SETTINGS_ASSETS
@ POS_SETTINGS_ASSETS
Definition:
menu_background.h:54
CMenuBackground::POS_BROWSER_CUSTOM4
@ POS_BROWSER_CUSTOM4
Definition:
menu_background.h:64
CMenuBackground::POS_RESERVED_NUM
@ POS_RESERVED_NUM
Definition:
menu_background.h:73
CMenuBackground::POS_BROWSER_CUSTOM3
@ POS_BROWSER_CUSTOM3
Definition:
menu_background.h:63
CMenuBackground::POS_SETTINGS_RESERVED1
@ POS_SETTINGS_RESERVED1
Definition:
menu_background.h:56
CMenuBackground::NUM_POS
@ NUM_POS
Definition:
menu_background.h:69
CMenuBackground::GetThemes
std::vector< CTheme > & GetThemes()
Definition:
menu_background.cpp:381
CMenuBackground::OnMapLoad
void OnMapLoad() override
Definition:
menu_background.cpp:293
CMenuBackground::m_vThemes
std::vector< CTheme > m_vThemes
Definition:
menu_background.h:100
CMenuBackground::m_IsInit
bool m_IsInit
Definition:
menu_background.h:93
CMenuBackground::m_CurrentDirection
vec2 m_CurrentDirection
Definition:
menu_background.h:88
CMenuBackground::m_MoveTime
float m_MoveTime
Definition:
menu_background.h:91
CMenuBackground::CreateBGMap
CBackgroundEngineMap * CreateBGMap() override
Definition:
menu_background.cpp:71
CMenuBackground::Sizeof
virtual int Sizeof() const override
Definition:
menu_background.h:104
CMenuBackground::LoadMenuBackground
void LoadMenuBackground(bool HasDayHint=true, bool HasNightHint=true)
Definition:
menu_background.cpp:167
CMenuBackground::CMenuBackground
CMenuBackground()
Definition:
menu_background.cpp:54
CMenuBackground::GetCurCamera
class CCamera * GetCurCamera() override
Definition:
menu_background.cpp:356
CMenuBackground::ThemeScan
static int ThemeScan(const char *pName, int IsDir, int DirType, void *pUser)
Definition:
menu_background.cpp:112
CMenuBackground::CanRenderMenuBackground
bool CanRenderMenuBackground() override
Definition:
menu_background.h:37
CMenuBackground::ChangePosition
void ChangePosition(int PositionNumber)
Definition:
menu_background.cpp:361
CMenuBackground::PREDEFINED_THEMES_COUNT
@ PREDEFINED_THEMES_COUNT
Definition:
menu_background.h:78
CMenuBackground::m_ChangedPosition
bool m_ChangedPosition
Definition:
menu_background.h:90
CMenuBackground::m_RotationCenter
vec2 m_RotationCenter
Definition:
menu_background.h:85
CMenuBackground::~CMenuBackground
~CMenuBackground() override
Definition:
menu_background.h:103
CMenuBackground::LoadThemeIcon
void LoadThemeIcon(CTheme &Theme)
Definition:
menu_background.cpp:98
CMenuMap
Definition:
menu_background.h:13
CTheme
Definition:
menu_background.h:19
CTheme::m_HasDay
bool m_HasDay
Definition:
menu_background.h:26
CTheme::CTheme
CTheme()
Definition:
menu_background.h:21
CTheme::m_IconTexture
IGraphics::CTextureHandle m_IconTexture
Definition:
menu_background.h:28
CTheme::CTheme
CTheme(const char *pName, bool HasDay, bool HasNight)
Definition:
menu_background.h:22
CTheme::operator<
bool operator<(const CTheme &Other) const
Definition:
menu_background.h:29
CTheme::m_HasNight
bool m_HasNight
Definition:
menu_background.h:27
CTheme::m_Name
std::string m_Name
Definition:
menu_background.h:25
IGraphics::CTextureHandle
Definition:
graphics.h:200
vector2_base< float >
MACRO_INTERFACE
#define MACRO_INTERFACE(Name)
Definition:
kernel.h:25
GenerateMenuBackgroundPositions
std::array< vec2, CMenuBackground::NUM_POS > GenerateMenuBackgroundPositions()
Definition:
menu_background.cpp:24
vec2
vector2_base< float > vec2
Definition:
vmath.h:158
src
game
client
components
menu_background.h
Generated by
1.9.4