| 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 | |
| 8 | #include <game/client/component.h> |
| 9 | |
| 10 | #include <optional> |
| 11 | |
| 12 | class CImportantAlert : public CComponent |
| 13 | { |
| 14 | bool m_Active = false; |
| 15 | float m_ActiveSince; |
| 16 | float m_FadeOutSince; |
| 17 | char m_aTitleText[128]; |
| 18 | char m_aMessageText[1024]; |
| 19 | STextContainerIndex m_TitleTextContainerIndex; |
| 20 | STextContainerIndex m_MessageTextContainerIndex; |
| 21 | STextContainerIndex m_CloseHintTextContainerIndex; |
| 22 | |
| 23 | void DeleteTextContainers(); |
| 24 | void RenderImportantAlert(); |
| 25 | void DoImportantAlert(const char *pTitle, const char *pLogGroup, const char *pMessage); |
| 26 | float SecondsActive() const; |
| 27 | |
| 28 | public: |
| 29 | int Sizeof() const override { return sizeof(*this); } |
| 30 | void OnReset() override; |
| 31 | void OnWindowResize() override; |
| 32 | void OnRender() override; |
| 33 | void OnMessage(int MsgType, void *pRawMsg) override; |
| 34 | bool OnInput(const IInput::CEvent &Event) override; |
| 35 | |
| 36 | bool IsActive() const; |
| 37 | }; |
| 38 | |
| 39 | #endif |
| 40 | |