DDraceNetwork Documentation
Loading...
Searching...
No Matches
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
(
const
char
*
pName
,
bool
HasDay
,
bool
HasNight
) :
22
m_Name
(
pName
),
m_HasDay
(
HasDay
),
m_HasNight
(
HasNight
) {}
23
24
std::string
m_Name
;
25
bool
m_HasDay
;
26
bool
m_HasNight
;
27
IGraphics::CTextureHandle
m_IconTexture
;
28
bool
operator<
(
const
CTheme
&
Other
)
const
{
return
m_Name
<
Other
.m_Name; }
29
};
30
31
class
CMenuBackground
:
public
CBackground
32
{
33
std::chrono::nanoseconds
m_ThemeScanStartTime
{0};
34
35
public
:
36
enum
37
{
38
POS_START
= 0,
39
POS_DEMOS
,
40
POS_NEWS
,
41
POS_SETTINGS_LANGUAGE
,
42
POS_SETTINGS_GENERAL
,
43
POS_SETTINGS_PLAYER
,
44
POS_SETTINGS_TEE
,
45
POS_SETTINGS_APPEARANCE
,
46
POS_SETTINGS_CONTROLS
,
47
POS_SETTINGS_GRAPHICS
,
48
POS_SETTINGS_SOUND
,
49
POS_SETTINGS_DDNET
,
50
POS_SETTINGS_ASSETS
,
51
POS_SETTINGS_RESERVED0
,
52
POS_SETTINGS_RESERVED1
,
53
POS_BROWSER_INTERNET
,
54
POS_BROWSER_LAN
,
55
POS_BROWSER_FAVORITES
,
56
POS_BROWSER_CUSTOM0
,
57
POS_BROWSER_CUSTOM1
,
58
POS_BROWSER_CUSTOM2
,
59
POS_BROWSER_CUSTOM3
,
60
POS_BROWSER_CUSTOM4
,
61
POS_RESERVED0
,
62
POS_RESERVED1
,
63
POS_RESERVED2
,
64
65
NUM_POS
,
66
67
POS_BROWSER_CUSTOM_NUM
= (
POS_BROWSER_CUSTOM4
-
POS_BROWSER_CUSTOM0
) + 1,
68
POS_SETTINGS_RESERVED_NUM
= (
POS_SETTINGS_RESERVED1
-
POS_SETTINGS_RESERVED0
) + 1,
69
POS_RESERVED_NUM
= (
POS_RESERVED2
-
POS_RESERVED0
) + 1,
70
};
71
72
enum
73
{
74
PREDEFINED_THEMES_COUNT
= 3,
75
};
76
77
private
:
78
CCamera
m_Camera
;
79
80
CBackgroundEngineMap
*
CreateBGMap
()
override
;
81
82
vec2
m_RotationCenter
;
83
std::array<vec2, NUM_POS>
m_aPositions
;
84
int
m_CurrentPosition
;
85
vec2
m_CurrentDirection
=
vec2
(1.0f, 0.0f);
86
vec2
m_AnimationStartPos
;
87
bool
m_ChangedPosition
;
88
float
m_MoveTime
;
89
90
bool
m_IsInit
;
91
bool
m_Loading
;
92
93
void
ResetPositions
();
94
95
void
LoadThemeIcon
(
CTheme
&
Theme
);
96
static
int
ThemeScan
(
const
char
*
pName
,
int
IsDir
,
int
DirType
,
void
*
pUser
);
97
98
std::vector<CTheme>
m_vThemes
;
99
100
public
:
101
CMenuBackground
();
102
int
Sizeof
()
const override
{
return
sizeof
(*this); }
103
104
void
OnInterfacesInit
(
CGameClient
*
pClient
)
override
;
105
void
OnInit
()
override
;
106
void
OnMapLoad
()
override
;
107
void
OnRender
()
override
;
108
109
void
LoadMenuBackground
(
bool
HasDayHint
=
true
,
bool
HasNightHint
=
true
);
110
111
bool
Render
();
112
bool
IsLoading
()
const
{
return
m_Loading
; }
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
CGameClient
Definition
gameclient.h:132
CMenuBackground
Definition
menu_background.h:32
CMenuBackground::ResetPositions
void ResetPositions()
Definition
menu_background.cpp:99
CMenuBackground::IsLoading
bool IsLoading() const
Definition
menu_background.h:112
CMenuBackground::OnRender
void OnRender() override
Definition
menu_background.cpp:306
CMenuBackground::m_AnimationStartPos
vec2 m_AnimationStartPos
Definition
menu_background.h:86
CMenuBackground::m_aPositions
std::array< vec2, NUM_POS > m_aPositions
Definition
menu_background.h:83
CMenuBackground::m_Camera
CCamera m_Camera
Definition
menu_background.h:78
CMenuBackground::m_CurrentPosition
int m_CurrentPosition
Definition
menu_background.h:84
CMenuBackground::Render
bool Render()
Definition
menu_background.cpp:310
CMenuBackground::m_ThemeScanStartTime
std::chrono::nanoseconds m_ThemeScanStartTime
Definition
menu_background.h:33
CMenuBackground::OnInit
void OnInit() override
Definition
menu_background.cpp:84
CMenuBackground::PREDEFINED_THEMES_COUNT
@ PREDEFINED_THEMES_COUNT
Definition
menu_background.h:74
CMenuBackground::GetThemes
std::vector< CTheme > & GetThemes()
Definition
menu_background.cpp:387
CMenuBackground::Sizeof
int Sizeof() const override
Definition
menu_background.h:102
CMenuBackground::OnMapLoad
void OnMapLoad() override
Definition
menu_background.cpp:302
CMenuBackground::m_vThemes
std::vector< CTheme > m_vThemes
Definition
menu_background.h:98
CMenuBackground::m_IsInit
bool m_IsInit
Definition
menu_background.h:90
CMenuBackground::m_CurrentDirection
vec2 m_CurrentDirection
Definition
menu_background.h:85
CMenuBackground::m_MoveTime
float m_MoveTime
Definition
menu_background.h:88
CMenuBackground::CreateBGMap
CBackgroundEngineMap * CreateBGMap() override
Definition
menu_background.cpp:72
CMenuBackground::POS_BROWSER_LAN
@ POS_BROWSER_LAN
Definition
menu_background.h:54
CMenuBackground::POS_RESERVED0
@ POS_RESERVED0
Definition
menu_background.h:61
CMenuBackground::POS_DEMOS
@ POS_DEMOS
Definition
menu_background.h:39
CMenuBackground::POS_SETTINGS_TEE
@ POS_SETTINGS_TEE
Definition
menu_background.h:44
CMenuBackground::POS_SETTINGS_DDNET
@ POS_SETTINGS_DDNET
Definition
menu_background.h:49
CMenuBackground::POS_RESERVED2
@ POS_RESERVED2
Definition
menu_background.h:63
CMenuBackground::POS_RESERVED1
@ POS_RESERVED1
Definition
menu_background.h:62
CMenuBackground::POS_SETTINGS_APPEARANCE
@ POS_SETTINGS_APPEARANCE
Definition
menu_background.h:45
CMenuBackground::POS_SETTINGS_SOUND
@ POS_SETTINGS_SOUND
Definition
menu_background.h:48
CMenuBackground::POS_SETTINGS_CONTROLS
@ POS_SETTINGS_CONTROLS
Definition
menu_background.h:46
CMenuBackground::POS_SETTINGS_RESERVED_NUM
@ POS_SETTINGS_RESERVED_NUM
Definition
menu_background.h:68
CMenuBackground::POS_BROWSER_CUSTOM0
@ POS_BROWSER_CUSTOM0
Definition
menu_background.h:56
CMenuBackground::POS_BROWSER_FAVORITES
@ POS_BROWSER_FAVORITES
Definition
menu_background.h:55
CMenuBackground::POS_SETTINGS_LANGUAGE
@ POS_SETTINGS_LANGUAGE
Definition
menu_background.h:41
CMenuBackground::POS_BROWSER_CUSTOM_NUM
@ POS_BROWSER_CUSTOM_NUM
Definition
menu_background.h:67
CMenuBackground::POS_NEWS
@ POS_NEWS
Definition
menu_background.h:40
CMenuBackground::POS_SETTINGS_GRAPHICS
@ POS_SETTINGS_GRAPHICS
Definition
menu_background.h:47
CMenuBackground::POS_BROWSER_CUSTOM1
@ POS_BROWSER_CUSTOM1
Definition
menu_background.h:57
CMenuBackground::POS_SETTINGS_RESERVED0
@ POS_SETTINGS_RESERVED0
Definition
menu_background.h:51
CMenuBackground::POS_SETTINGS_GENERAL
@ POS_SETTINGS_GENERAL
Definition
menu_background.h:42
CMenuBackground::POS_BROWSER_CUSTOM2
@ POS_BROWSER_CUSTOM2
Definition
menu_background.h:58
CMenuBackground::POS_SETTINGS_PLAYER
@ POS_SETTINGS_PLAYER
Definition
menu_background.h:43
CMenuBackground::POS_START
@ POS_START
Definition
menu_background.h:38
CMenuBackground::POS_BROWSER_INTERNET
@ POS_BROWSER_INTERNET
Definition
menu_background.h:53
CMenuBackground::POS_SETTINGS_ASSETS
@ POS_SETTINGS_ASSETS
Definition
menu_background.h:50
CMenuBackground::POS_BROWSER_CUSTOM4
@ POS_BROWSER_CUSTOM4
Definition
menu_background.h:60
CMenuBackground::POS_RESERVED_NUM
@ POS_RESERVED_NUM
Definition
menu_background.h:69
CMenuBackground::POS_BROWSER_CUSTOM3
@ POS_BROWSER_CUSTOM3
Definition
menu_background.h:59
CMenuBackground::POS_SETTINGS_RESERVED1
@ POS_SETTINGS_RESERVED1
Definition
menu_background.h:52
CMenuBackground::NUM_POS
@ NUM_POS
Definition
menu_background.h:65
CMenuBackground::LoadMenuBackground
void LoadMenuBackground(bool HasDayHint=true, bool HasNightHint=true)
Definition
menu_background.cpp:173
CMenuBackground::CMenuBackground
CMenuBackground()
Definition
menu_background.cpp:54
CMenuBackground::GetCurCamera
class CCamera * GetCurCamera() override
Definition
menu_background.cpp:362
CMenuBackground::OnInterfacesInit
void OnInterfacesInit(CGameClient *pClient) override
Definition
menu_background.cpp:77
CMenuBackground::ThemeScan
static int ThemeScan(const char *pName, int IsDir, int DirType, void *pUser)
Definition
menu_background.cpp:118
CMenuBackground::m_Loading
bool m_Loading
Definition
menu_background.h:91
CMenuBackground::ChangePosition
void ChangePosition(int PositionNumber)
Definition
menu_background.cpp:367
CMenuBackground::m_ChangedPosition
bool m_ChangedPosition
Definition
menu_background.h:87
CMenuBackground::m_RotationCenter
vec2 m_RotationCenter
Definition
menu_background.h:82
CMenuBackground::LoadThemeIcon
void LoadThemeIcon(CTheme &Theme)
Definition
menu_background.cpp:104
CMenuMap
Definition
menu_background.h:13
CTheme
Definition
menu_background.h:19
CTheme::m_HasDay
bool m_HasDay
Definition
menu_background.h:25
CTheme::m_IconTexture
IGraphics::CTextureHandle m_IconTexture
Definition
menu_background.h:27
CTheme::CTheme
CTheme(const char *pName, bool HasDay, bool HasNight)
Definition
menu_background.h:21
CTheme::operator<
bool operator<(const CTheme &Other) const
Definition
menu_background.h:28
CTheme::m_HasNight
bool m_HasNight
Definition
menu_background.h:26
CTheme::m_Name
std::string m_Name
Definition
menu_background.h:24
IGraphics::CTextureHandle
Definition
graphics.h:205
vector2_base
Definition
vmath.h:15
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:161
src
game
client
components
menu_background.h
Generated by
1.9.8