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