DDNet documentation
Loading...
Searching...
No Matches
important_alert.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_IMPORTANT_ALERT_H
4#define GAME_CLIENT_COMPONENTS_IMPORTANT_ALERT_H
5
6#include <engine/textrender.h>
7
10
11#include <chrono>
12#include <optional>
13
15{
16 bool m_Active = false;
18 std::chrono::nanoseconds m_ActiveSinceNanos{0};
20 char m_aTitleText[128];
21 char m_aMessageText[1024];
25 bool m_CloseHintShownForTouch = false; // whether the close hint text was created for touch controls
26 std::optional<CUIRect> m_DismissTouchRect; // in normalized screen coordinates like the touch finger positions
27 std::optional<IInput::CTouchFinger> m_DismissTouchFinger; // the finger that dismissed the alert, ignored until released
28
31 void DoImportantAlert(const char *pTitle, const char *pLogGroup, const char *pMessage);
32 float SecondsActive() const;
33
34public:
35 int Sizeof() const override { return sizeof(*this); }
36 void OnReset() override;
37 void OnWindowResize() override;
38 void OnRender() override;
39 void OnMessage(int MsgType, void *pRawMsg) override;
40 bool OnInput(const IInput::CEvent &Event) override;
41 bool OnTouchState(std::vector<IInput::CTouchFingerState> &vTouchFingerStates) override;
42
43 bool IsActive() const;
44};
45
46#endif
Definition component.h:165
Definition important_alert.h:15
char m_aMessageText[1024]
Definition important_alert.h:21
void OnWindowResize() override
Definition important_alert.cpp:31
bool m_Active
Definition important_alert.h:16
char m_aTitleText[128]
Definition important_alert.h:20
void RenderImportantAlert()
Definition important_alert.cpp:62
void OnReset() override
Definition important_alert.cpp:24
bool IsActive() const
Definition important_alert.cpp:274
int Sizeof() const override
Definition important_alert.h:35
void OnRender() override
Definition important_alert.cpp:36
void OnMessage(int MsgType, void *pRawMsg) override
Definition important_alert.cpp:195
float SecondsActive() const
Definition important_alert.cpp:190
void DoImportantAlert(const char *pTitle, const char *pLogGroup, const char *pMessage)
Definition important_alert.cpp:164
void DeleteTextContainers()
Definition important_alert.cpp:55
STextContainerIndex m_TitleTextContainerIndex
Definition important_alert.h:22
float m_ActiveSince
Definition important_alert.h:17
bool OnInput(const IInput::CEvent &Event) override
Definition important_alert.cpp:209
STextContainerIndex m_CloseHintTextContainerIndex
Definition important_alert.h:24
std::optional< IInput::CTouchFinger > m_DismissTouchFinger
Definition important_alert.h:27
bool OnTouchState(std::vector< IInput::CTouchFingerState > &vTouchFingerStates) override
Definition important_alert.cpp:225
bool m_CloseHintShownForTouch
Definition important_alert.h:25
std::chrono::nanoseconds m_ActiveSinceNanos
Definition important_alert.h:18
std::optional< CUIRect > m_DismissTouchRect
Definition important_alert.h:26
float m_FadeOutSince
Definition important_alert.h:19
STextContainerIndex m_MessageTextContainerIndex
Definition important_alert.h:23
Definition input.h:22
Definition textrender.h:175