1#ifndef GAME_EDITOR_FONT_TYPER_H
2#define GAME_EDITOR_FONT_TYPER_H
3
4#include "component.h"
5
6#include <base/vmath.h>
7
8#include <engine/graphics.h>
9
10#include <game/client/ui.h>
11
12#include <chrono>
13#include <memory>
14
15class CLayer;
16class CLayerTiles;
17
18class CFontTyper : public CEditorComponent
19{
20 enum
21 {
22 LETTER_OFFSET = 1,
23 NUMBER_OFFSET = 54,
24 };
25 ivec2 m_TextIndex = ivec2(0, 0);
26 int m_TextLineLen = 0;
27 bool m_Active = false;
28 std::chrono::nanoseconds m_CursorRenderTime;
29 IGraphics::CTextureHandle m_CursorTextTexture;
30 std::shared_ptr<CLayer> m_pLastLayer;
31 CUi::SConfirmPopupContext m_ConfirmActivatePopupContext;
32 int m_TilesPlacedSinceActivate = 0;
33
34 void SetCursor();
35 void TextModeOff();
36 void TextModeOn();
37 void SetTile(ivec2 Pos, unsigned char Index, const std::shared_ptr<CLayerTiles> &pLayer);
38
39public:
40 void OnRender(CUIRect View) override;
41 bool OnInput(const IInput::CEvent &Event) override;
42 void OnInit(CEditor *pEditor) override;
43
44 bool IsActive() const { return m_Active; }
45};
46
47#endif
48