DDNet documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
motd.h
Go to the documentation of this file.
1
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2
/* If you are missing that file, acquire a complete release at teeworlds.com. */
3
#ifndef GAME_CLIENT_COMPONENTS_MOTD_H
4
#define GAME_CLIENT_COMPONENTS_MOTD_H
5
6
#include <
engine/shared/config.h
>
7
#include <
engine/textrender.h
>
8
9
#include <
game/client/component.h
>
10
#include <
game/client/ui_rect.h
>
11
12
#include <chrono>
13
#include <optional>
14
15
class
CMotd
:
public
CComponent
16
{
17
char
m_aServerMotd
[std::size(
g_Config
.
m_SvMotd
)];
18
int64_t
m_ServerMotdTime
;
19
int64_t
m_ServerMotdUpdateTime
;
20
std::chrono::nanoseconds
m_ShownSince
{0};
// when the MOTD last became visible
21
int
m_RectQuadContainer
= -1;
22
STextContainerIndex
m_TextContainerIndex
;
23
std::optional<CUIRect>
m_TouchRect
;
// in normalized screen coordinates like the touch finger positions
24
std::optional<IInput::CTouchFinger>
m_DismissTouchFinger
;
// the finger that dismissed the MOTD, ignored until released
25
26
public
:
27
CMotd
();
28
int
Sizeof
()
const override
{
return
sizeof
(*this); }
29
30
const
char
*
ServerMotd
()
const
{
return
m_aServerMotd
; }
31
int64_t
ServerMotdUpdateTime
()
const
{
return
m_ServerMotdUpdateTime
; }
32
void
Clear
();
33
bool
IsActive
()
const
;
34
35
void
OnRender
()
override
;
36
void
OnStateChange
(
int
NewState,
int
OldState)
override
;
37
void
OnWindowResize
()
override
;
38
void
OnMessage
(
int
MsgType,
void
*pRawMsg)
override
;
39
bool
OnInput
(
const
IInput::CEvent
&Event)
override
;
40
bool
OnTouchState
(std::vector<IInput::CTouchFingerState> &vTouchFingerStates)
override
;
41
};
42
43
#endif
CComponent
Definition
component.h:165
CConfig::m_SvMotd
char m_SvMotd[900]
Definition
config.h:275
CMotd::m_RectQuadContainer
int m_RectQuadContainer
Definition
motd.h:21
CMotd::m_aServerMotd
char m_aServerMotd[std::size(g_Config.m_SvMotd)]
Definition
motd.h:17
CMotd::Sizeof
int Sizeof() const override
Definition
motd.h:28
CMotd::OnWindowResize
void OnWindowResize() override
Definition
motd.cpp:49
CMotd::m_ServerMotdTime
int64_t m_ServerMotdTime
Definition
motd.h:18
CMotd::m_ShownSince
std::chrono::nanoseconds m_ShownSince
Definition
motd.h:20
CMotd::OnRender
void OnRender() override
Definition
motd.cpp:55
CMotd::OnMessage
void OnMessage(int MsgType, void *pRawMsg) override
Definition
motd.cpp:110
CMotd::IsActive
bool IsActive() const
Definition
motd.cpp:38
CMotd::m_TextContainerIndex
STextContainerIndex m_TextContainerIndex
Definition
motd.h:22
CMotd::ServerMotd
const char * ServerMotd() const
Definition
motd.h:30
CMotd::m_TouchRect
std::optional< CUIRect > m_TouchRect
Definition
motd.h:23
CMotd::OnStateChange
void OnStateChange(int NewState, int OldState) override
Definition
motd.cpp:43
CMotd::ServerMotdUpdateTime
int64_t ServerMotdUpdateTime() const
Definition
motd.h:31
CMotd::Clear
void Clear()
Definition
motd.cpp:30
CMotd::m_DismissTouchFinger
std::optional< IInput::CTouchFinger > m_DismissTouchFinger
Definition
motd.h:24
CMotd::CMotd
CMotd()
Definition
motd.cpp:23
CMotd::OnInput
bool OnInput(const IInput::CEvent &Event) override
Definition
motd.cpp:163
CMotd::m_ServerMotdUpdateTime
int64_t m_ServerMotdUpdateTime
Definition
motd.h:19
CMotd::OnTouchState
bool OnTouchState(std::vector< IInput::CTouchFingerState > &vTouchFingerStates) override
Definition
motd.cpp:173
IInput::CEvent
Definition
input.h:22
component.h
g_Config
CConfig g_Config
Definition
config.cpp:16
config.h
STextContainerIndex
Definition
textrender.h:175
textrender.h
ui_rect.h
src
game
client
components
motd.h
Generated by
1.18.0