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
public
:
37
enum
38
{
39
POS_START
= 0,
40
POS_DEMOS
,
41
POS_NEWS
,
42
POS_SETTINGS_LANGUAGE
,
43
POS_SETTINGS_GENERAL
,
44
POS_SETTINGS_PLAYER
,
45
POS_SETTINGS_TEE
,
46
POS_SETTINGS_APPEARANCE
,
47
POS_SETTINGS_CONTROLS
,
48
POS_SETTINGS_GRAPHICS
,
49
POS_SETTINGS_SOUND
,
50
POS_SETTINGS_DDNET
,
51
POS_SETTINGS_ASSETS
,
52
POS_SETTINGS_RESERVED0
,
53
POS_SETTINGS_RESERVED1
,
54
POS_BROWSER_INTERNET
,
55
POS_BROWSER_LAN
,
56
POS_BROWSER_FAVORITES
,
57
POS_BROWSER_CUSTOM0
,
58
POS_BROWSER_CUSTOM1
,
59
POS_BROWSER_CUSTOM2
,
60
POS_BROWSER_CUSTOM3
,
61
POS_BROWSER_CUSTOM4
,
62
POS_RESERVED0
,
63
POS_RESERVED1
,
64
POS_RESERVED2
,
65
66
NUM_POS
,
67
68
POS_BROWSER_CUSTOM_NUM
= (
POS_BROWSER_CUSTOM4
-
POS_BROWSER_CUSTOM0
) + 1,
69
POS_SETTINGS_RESERVED_NUM
= (
POS_SETTINGS_RESERVED1
-
POS_SETTINGS_RESERVED0
) + 1,
70
POS_RESERVED_NUM
= (
POS_RESERVED2
-
POS_RESERVED0
) + 1,
71
};
72
73
enum
74
{
75
PREDEFINED_THEMES_COUNT
= 3,
76
};
77
78
private
:
79
CCamera
m_Camera
;
80
81
CBackgroundEngineMap
*
CreateBGMap
()
override
;
82
83
vec2
m_RotationCenter
;
84
std::array<vec2, NUM_POS>
m_aPositions
;
85
int
m_CurrentPosition
;
86
vec2
m_CurrentDirection
=
vec2
(1.0f, 0.0f);
87
vec2
m_AnimationStartPos
;
88
bool
m_ChangedPosition
;
89
float
m_MoveTime
;
90
91
bool
m_IsInit
;
92
bool
m_Loading
;
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
101
public
:
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
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
123
std::array<vec2, CMenuBackground::NUM_POS>
GenerateMenuBackgroundPositions
();
124
125
#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:94
CMenuBackground::IsLoading
bool IsLoading() const
Definition:
menu_background.h:113
CMenuBackground::OnRender
void OnRender() override
Definition:
menu_background.cpp:301
CMenuBackground::m_AnimationStartPos
vec2 m_AnimationStartPos
Definition:
menu_background.h:87
CMenuBackground::m_aPositions
std::array< vec2, NUM_POS > m_aPositions
Definition:
menu_background.h:84
CMenuBackground::m_Camera
CCamera m_Camera
Definition:
menu_background.h:79
CMenuBackground::m_CurrentPosition
int m_CurrentPosition
Definition:
menu_background.h:85
CMenuBackground::Render
bool Render()
Definition:
menu_background.cpp:305
CMenuBackground::m_ThemeScanStartTime
std::chrono::nanoseconds m_ThemeScanStartTime
Definition:
menu_background.h:34
CMenuBackground::OnInit
void OnInit() override
Definition:
menu_background.cpp:77
CMenuBackground::POS_BROWSER_LAN
@ POS_BROWSER_LAN
Definition:
menu_background.h:55
CMenuBackground::POS_RESERVED0
@ POS_RESERVED0
Definition:
menu_background.h:62
CMenuBackground::POS_DEMOS
@ POS_DEMOS
Definition:
menu_background.h:40
CMenuBackground::POS_SETTINGS_TEE
@ POS_SETTINGS_TEE
Definition:
menu_background.h:45
CMenuBackground::POS_SETTINGS_DDNET
@ POS_SETTINGS_DDNET
Definition:
menu_background.h:50
CMenuBackground::POS_RESERVED2
@ POS_RESERVED2
Definition:
menu_background.h:64
CMenuBackground::POS_RESERVED1
@ POS_RESERVED1
Definition:
menu_background.h:63
CMenuBackground::POS_SETTINGS_APPEARANCE
@ POS_SETTINGS_APPEARANCE
Definition:
menu_background.h:46
CMenuBackground::POS_SETTINGS_SOUND
@ POS_SETTINGS_SOUND
Definition:
menu_background.h:49
CMenuBackground::POS_SETTINGS_CONTROLS
@ POS_SETTINGS_CONTROLS
Definition:
menu_background.h:47
CMenuBackground::POS_SETTINGS_RESERVED_NUM
@ POS_SETTINGS_RESERVED_NUM
Definition:
menu_background.h:69
CMenuBackground::POS_BROWSER_CUSTOM0
@ POS_BROWSER_CUSTOM0
Definition:
menu_background.h:57
CMenuBackground::POS_BROWSER_FAVORITES
@ POS_BROWSER_FAVORITES
Definition:
menu_background.h:56
CMenuBackground::POS_SETTINGS_LANGUAGE
@ POS_SETTINGS_LANGUAGE
Definition:
menu_background.h:42
CMenuBackground::POS_BROWSER_CUSTOM_NUM
@ POS_BROWSER_CUSTOM_NUM
Definition:
menu_background.h:68
CMenuBackground::POS_NEWS
@ POS_NEWS
Definition:
menu_background.h:41
CMenuBackground::POS_SETTINGS_GRAPHICS
@ POS_SETTINGS_GRAPHICS
Definition:
menu_background.h:48
CMenuBackground::POS_BROWSER_CUSTOM1
@ POS_BROWSER_CUSTOM1
Definition:
menu_background.h:58
CMenuBackground::POS_SETTINGS_RESERVED0
@ POS_SETTINGS_RESERVED0
Definition:
menu_background.h:52
CMenuBackground::POS_SETTINGS_GENERAL
@ POS_SETTINGS_GENERAL
Definition:
menu_background.h:43
CMenuBackground::POS_BROWSER_CUSTOM2
@ POS_BROWSER_CUSTOM2
Definition:
menu_background.h:59
CMenuBackground::POS_SETTINGS_PLAYER
@ POS_SETTINGS_PLAYER
Definition:
menu_background.h:44
CMenuBackground::POS_START
@ POS_START
Definition:
menu_background.h:39
CMenuBackground::POS_BROWSER_INTERNET
@ POS_BROWSER_INTERNET
Definition:
menu_background.h:54
CMenuBackground::POS_SETTINGS_ASSETS
@ POS_SETTINGS_ASSETS
Definition:
menu_background.h:51
CMenuBackground::POS_BROWSER_CUSTOM4
@ POS_BROWSER_CUSTOM4
Definition:
menu_background.h:61
CMenuBackground::POS_RESERVED_NUM
@ POS_RESERVED_NUM
Definition:
menu_background.h:70
CMenuBackground::POS_BROWSER_CUSTOM3
@ POS_BROWSER_CUSTOM3
Definition:
menu_background.h:60
CMenuBackground::POS_SETTINGS_RESERVED1
@ POS_SETTINGS_RESERVED1
Definition:
menu_background.h:53
CMenuBackground::NUM_POS
@ NUM_POS
Definition:
menu_background.h:66
CMenuBackground::GetThemes
std::vector< CTheme > & GetThemes()
Definition:
menu_background.cpp:390
CMenuBackground::OnMapLoad
void OnMapLoad() override
Definition:
menu_background.cpp:297
CMenuBackground::m_vThemes
std::vector< CTheme > m_vThemes
Definition:
menu_background.h:99
CMenuBackground::m_IsInit
bool m_IsInit
Definition:
menu_background.h:91
CMenuBackground::m_CurrentDirection
vec2 m_CurrentDirection
Definition:
menu_background.h:86
CMenuBackground::m_MoveTime
float m_MoveTime
Definition:
menu_background.h:89
CMenuBackground::CreateBGMap
CBackgroundEngineMap * CreateBGMap() override
Definition:
menu_background.cpp:72
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:168
CMenuBackground::CMenuBackground
CMenuBackground()
Definition:
menu_background.cpp:54
CMenuBackground::GetCurCamera
class CCamera * GetCurCamera() override
Definition:
menu_background.cpp:360
CMenuBackground::ThemeScan
static int ThemeScan(const char *pName, int IsDir, int DirType, void *pUser)
Definition:
menu_background.cpp:113
CMenuBackground::m_Loading
bool m_Loading
Definition:
menu_background.h:92
CMenuBackground::ChangePosition
void ChangePosition(int PositionNumber)
Definition:
menu_background.cpp:370
CMenuBackground::PREDEFINED_THEMES_COUNT
@ PREDEFINED_THEMES_COUNT
Definition:
menu_background.h:75
CMenuBackground::m_ChangedPosition
bool m_ChangedPosition
Definition:
menu_background.h:88
CMenuBackground::m_RotationCenter
vec2 m_RotationCenter
Definition:
menu_background.h:83
CMenuBackground::LoadingTitle
const char * LoadingTitle() const override
Definition:
menu_background.cpp:365
CMenuBackground::~CMenuBackground
~CMenuBackground() override
Definition:
menu_background.h:103
CMenuBackground::LoadThemeIcon
void LoadThemeIcon(CTheme &Theme)
Definition:
menu_background.cpp:99
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:201
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