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{
20public:
21 class CState
22 {
23 public:
24 bool m_Active;
25 ivec2 m_TextIndex;
26 int m_TextLineLen;
27 std::shared_ptr<CLayer> m_pLastLayer;
28 int m_TilesPlacedSinceActivate;
29
30 void Reset();
31 };
32
33 void OnInit(CEditor *pEditor) override;
34 bool OnInput(const IInput::CEvent &Event) override;
35 void Render();
36
37 bool IsActive() const;
38
39private:
40 enum
41 {
42 LETTER_OFFSET = 1,
43 NUMBER_OFFSET = 54,
44 };
45 std::chrono::nanoseconds m_CursorRenderTime;
46 IGraphics::CTextureHandle m_CursorTextTexture;
47 CUi::SConfirmPopupContext m_ConfirmActivatePopupContext;
48
49 void SetCursor();
50 void TextModeOff();
51 void TextModeOn();
52 void SetTile(ivec2 Pos, unsigned char Index, const std::shared_ptr<CLayerTiles> &pLayer);
53};
54
55#endif
56