1#ifndef GAME_EDITOR_MAP_GRID_H
2#define GAME_EDITOR_MAP_GRID_H
3
4#include "component.h"
5
6#include <game/client/ui.h>
7
8class CMapGrid : public CEditorComponent
9{
10public:
11 class CState
12 {
13 public:
14 bool m_GridActive;
15 int m_GridFactor;
16
17 void Reset();
18 };
19
20 void Render();
21
22 void SnapToGrid(vec2 &Position) const;
23 int GridLineDistance() const;
24
25 /**
26 * Returns whether the grid is rendered.
27 */
28 bool IsEnabled() const;
29
30 void Toggle();
31
32 int Factor() const;
33 void SetFactor(int Factor);
34
35 void DoSettingsPopup(vec2 Position);
36
37private:
38 SPopupMenuId m_PopupGridSettingsId;
39 static CUi::EPopupMenuFunctionResult PopupGridSettings(void *pContext, CUIRect View, bool Active);
40};
41
42#endif
43